<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.3.333">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

<meta name="author" content="Solveig Bjørkholt">
<meta name="dcterms.date" content="2024-09-27">

<title>Logfile for Replication of Presenting the StanDat Database on International Standards: Improving Data Accessibility on Marginal Topics</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
  width: 0.8em;
  margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */ 
  vertical-align: middle;
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
  { counter-reset: source-line 0; }
pre.numberSource code > span
  { position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
  { content: counter(source-line);
    position: relative; left: -1em; text-align: right; vertical-align: baseline;
    border: none; display: inline-block;
    -webkit-touch-callout: none; -webkit-user-select: none;
    -khtml-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
    padding: 0 4px; width: 4em;
  }
pre.numberSource { margin-left: 3em;  padding-left: 4px; }
div.sourceCode
  {   }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
</style>


<script src="Logfile_files/libs/clipboard/clipboard.min.js"></script>
<script src="Logfile_files/libs/quarto-html/quarto.js"></script>
<script src="Logfile_files/libs/quarto-html/popper.min.js"></script>
<script src="Logfile_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="Logfile_files/libs/quarto-html/anchor.min.js"></script>
<link href="Logfile_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="Logfile_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="Logfile_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="Logfile_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="Logfile_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">


</head>

<body class="fullcontent">

<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">

<main class="content" id="quarto-document-content">

<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">Logfile for Replication of Presenting the StanDat Database on International Standards: Improving Data Accessibility on Marginal Topics</h1>
</div>



<div class="quarto-title-meta">

    <div>
    <div class="quarto-title-meta-heading">Author</div>
    <div class="quarto-title-meta-contents">
             <p>Solveig Bjørkholt </p>
          </div>
  </div>
    
    <div>
    <div class="quarto-title-meta-heading">Published</div>
    <div class="quarto-title-meta-contents">
      <p class="date">September 27, 2024</p>
    </div>
  </div>
  
    
  </div>
  

</header>

<div class="cell">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span>opts_chunk<span class="sc">$</span><span class="fu">set</span>(<span class="at">echo =</span> <span class="cn">TRUE</span>, <span class="at">results =</span> <span class="st">"markup"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<section id="figure-1" class="level1">
<h1>Figure 1</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">spin</span>(<span class="st">"Figure1.R"</span>, <span class="at">knit =</span> <span class="cn">FALSE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "Figure1.Rmd"</code></pre>
</div>
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="st">"Figure1.R"</span>, <span class="at">echo =</span> <span class="cn">TRUE</span>, <span class="at">print.eval =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; pacman::p_load(dplyr, tidyr, DBI, RSQLite)

&gt; con &lt;- dbConnect(RSQLite::SQLite(), "iso_standards.sqlite")

&gt; standards &lt;- dbReadTable(con, "standards_status")

&gt; dbDisconnect(con)

&gt; data_figure1 &lt;- standards %&gt;% group_by(year) %&gt;% count() %&gt;% 
+     ungroup() %&gt;% drop_na() %&gt;% filter(year &lt;= 2021) %&gt;% mutate(aggcount = cumsum(n) .... [TRUNCATED] </code></pre>
</div>
</div>
</section>
<section id="figure-3" class="level1">
<h1>Figure 3</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">spin</span>(<span class="st">"Figure3.R"</span>, <span class="at">knit =</span> <span class="cn">FALSE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "Figure3.Rmd"</code></pre>
</div>
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="st">"Figure3.R"</span>, <span class="at">echo =</span> <span class="cn">TRUE</span>, <span class="at">print.eval =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; pacman::p_load(dplyr, ggplot2, tidyr, stringr, DBI, 
+     RSQLite)

&gt; con &lt;- dbConnect(RSQLite::SQLite(), "iso_standards.sqlite")

&gt; standards &lt;- dbReadTable(con, "standards_status")

&gt; sectors &lt;- readRDS("sectors.rds")

&gt; dbDisconnect(con)

&gt; cbPalette &lt;- c("#164688", "#f53f00", "#fad200", "#5f9d03", 
+     "#77001f", "#8ecbff", "#324000", "#b0cf00", "#492071")

&gt; sectormerge &lt;- sectors %&gt;% select(committee, sector) %&gt;% 
+     unique()

&gt; fig &lt;- standards %&gt;% left_join(sectormerge, by = "committee")

&gt; na_sectors &lt;- fig %&gt;% distinct() %&gt;% filter(is.na(sector))

&gt; na_sectors_filled &lt;- na_sectors %&gt;% select(-sector) %&gt;% 
+     mutate(committee2 = str_remove(committee, "\\/SC.*"), committee2 = str_squish(committ .... [TRUNCATED] 

&gt; fig &lt;- fig %&gt;% anti_join(na_sectors, by = join_by(committee, 
+     title)) %&gt;% bind_rows(na_sectors_filled)

&gt; fig %&gt;% mutate(sector = case_when(sector == "Chemicals" ~ 
+     "Generalities, infrastructures,\nand sciences", sector == 
+     "Energy" ~ "Engine ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 9 rows containing non-finite values (`stat_align()`).</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Logfile_files/figure-html/figure3-1.png" class="img-fluid" width="672"></p>
</div>
</div>
</section>
<section id="figure-4" class="level1">
<h1>Figure 4</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">spin</span>(<span class="st">"Figure4.R"</span>, <span class="at">knit =</span> <span class="cn">FALSE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "Figure4.Rmd"</code></pre>
</div>
<div class="sourceCode cell-code" id="cb13"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="st">"Figure4.R"</span>, <span class="at">echo =</span> <span class="cn">TRUE</span>, <span class="at">print.eval =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; pacman::p_load(dplyr, ggplot2, cowplot, DBI, RSQLite)

&gt; con &lt;- dbConnect(RSQLite::SQLite(), "iso_standards.sqlite")

&gt; tc_creation &lt;- dbReadTable(con, "historical_tc_creation") %&gt;% 
+     mutate(year = as.numeric(year)) %&gt;% na.omit()

&gt; dbDisconnect(con)

&gt; tc_plot1 &lt;- tc_creation %&gt;% mutate(spec = ifelse(sector %in% 
+     c("Business management and innovation", "Sustainability and environment", 
+     .... [TRUNCATED] 

&gt; tc_plot2 &lt;- tc_creation %&gt;% filter(sector %in% c("Business management and innovation", 
+     "Sustainability and environment", "Services", "Securit ..." ... [TRUNCATED] 

&gt; plot_grid(tc_plot1, tc_plot2, ncol = 1, byrow = TRUE, 
+     label_size = 10, align = "v")</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Logfile_files/figure-html/figure4-1.png" class="img-fluid" width="672"></p>
</div>
</div>
</section>
<section id="figure-5" class="level1">
<h1>Figure 5</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb15"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">spin</span>(<span class="st">"Figure5.R"</span>, <span class="at">knit =</span> <span class="cn">FALSE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "Figure5.Rmd"</code></pre>
</div>
<div class="sourceCode cell-code" id="cb17"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="st">"Figure5.R"</span>, <span class="at">echo =</span> <span class="cn">TRUE</span>, <span class="at">print.eval =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; pacman::p_load(dplyr, ggplot2, tidyr, cowplot, DBI, 
+     RSQLite)

&gt; con &lt;- dbConnect(RSQLite::SQLite(), "iso_standards.sqlite")

&gt; participation &lt;- dbReadTable(con, "participants")

&gt; dbDisconnect(con)

&gt; memberships &lt;- participation %&gt;% mutate(country = countrycode::countrycode(sourcevar = country, 
+     origin = "country.name", destination = "count ..." ... [TRUNCATED] 

&gt; participation %&gt;% filter(country %in% c("United States", 
+     "France", "Germany", "United Kingdom", "China")) %&gt;% filter(membership %in% 
+     c .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output-display">
<p><img src="Logfile_files/figure-html/figure5-1.png" class="img-fluid" width="672"></p>
</div>
</div>
</section>
<section id="figure-6" class="level1">
<h1>Figure 6</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb19"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">spin</span>(<span class="st">"Figure6.R"</span>, <span class="at">knit =</span> <span class="cn">FALSE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "Figure6.Rmd"</code></pre>
</div>
<div class="sourceCode cell-code" id="cb21"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="st">"Figure6.R"</span>, <span class="at">echo =</span> <span class="cn">TRUE</span>, <span class="at">print.eval =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; pacman::p_load(dplyr, ggplot2, stringr, tidyr, countrycode, 
+     DBI, RSQLite)

&gt; options(scipen = 999)

&gt; con &lt;- dbConnect(RSQLite::SQLite(), "iso_standards.sqlite")

&gt; country_certifications &lt;- dbReadTable(con, "country_certifications")

&gt; dbDisconnect(con)

&gt; cbPalette &lt;- c("#164688", "#f53f00", "#fad200", "#5f9d03", 
+     "#77001f", "#8ecbff", "#324000", "#b0cf00", "#492071")

&gt; country_certifications &lt;- country_certifications %&gt;% 
+     mutate(country = ifelse(country == "Russion Federation", 
+         "Russian Federation" .... [TRUNCATED] 

&gt; cert_agg &lt;- country_certifications %&gt;% mutate(continent = countrycode(sourcevar = country, 
+     origin = "country.name", destination = "un.region. ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `continent = countrycode(sourcevar = country, origin =
  "country.name", destination = "un.region.name")`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Kosovo, Netherlands Antilles, Taiwan</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; cert_agg %&gt;% na.omit() %&gt;% mutate(continent = ifelse(continent == 
+     "Asia", "Asia &amp; Oceania", ifelse(continent == "Oceania", 
+     "Asia &amp; Oce ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>`summarise()` has grouped output by 'continent', 'year', 'iso'. You can
override using the `.groups` argument.</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Logfile_files/figure-html/figure6-1.png" class="img-fluid" width="672"></p>
</div>
</div>
</section>
<section id="figure-7" class="level1">
<h1>Figure 7</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb26"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">spin</span>(<span class="st">"Figure7.R"</span>, <span class="at">knit =</span> <span class="cn">FALSE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "Figure7.Rmd"</code></pre>
</div>
<div class="sourceCode cell-code" id="cb28"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="st">"Figure7.R"</span>, <span class="at">echo =</span> <span class="cn">TRUE</span>, <span class="at">print.eval =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; pacman::p_load(dplyr, ggplot2, countrycode, igraph, 
+     Matrix, tidygraph, ggraph, DBI, RSQLite)

&gt; con &lt;- dbConnect(RSQLite::SQLite(), "iso_standards.sqlite")

&gt; participation &lt;- dbReadTable(con, "participants")

&gt; dbDisconnect(con)

&gt; get_network &lt;- function(year) {
+     participation &lt;- participation %&gt;% filter(year == !!year)
+     edgelist &lt;- participation %&gt;% filter(membershi .... [TRUNCATED] 

&gt; gdata &lt;- get_network(2022)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: `bipartite.mapping()` was deprecated in igraph 2.0.0.
ℹ Please use `bipartite_mapping()` instead.</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: `as_incidence_matrix()` was deprecated in igraph 1.6.0.
ℹ Please use `as_biadjacency_matrix()` instead.</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; continents &lt;- participation %&gt;% mutate(Continent = countrycode(sourcevar = country, 
+     origin = "country.name", destination = "continent")) %&gt;%  .... [TRUNCATED] 

&gt; gdata[[1]] %&gt;% as_tbl_graph() %&gt;% activate(nodes) %&gt;% 
+     left_join(continents, by = c(name = "country")) %&gt;% mutate(name = ifelse(name == 
+     .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Using the `size` aesthetic in this geom was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` in the `default_aes` field and elsewhere instead.</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
found in Windows font database

Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
found in Windows font database</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Logfile_files/figure-html/figure7-1.png" class="img-fluid" width="672"></p>
</div>
</div>
</section>
<section id="table-4" class="level1">
<h1>Table 4</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb36"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb36-1"><a href="#cb36-1" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">spin</span>(<span class="st">"Table4.R"</span>, <span class="at">knit =</span> <span class="cn">FALSE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "Table4.Rmd"</code></pre>
</div>
<div class="sourceCode cell-code" id="cb38"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb38-1"><a href="#cb38-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="st">"Table4.R"</span>, <span class="at">echo =</span> <span class="cn">TRUE</span>, <span class="at">print.eval =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; pacman::p_load(tidyverse, fixest, modelsummary, kableExtra)

&gt; alldata1 &lt;- read_rds("replication_data1.rds")

&gt; alldata2 &lt;- read_rds("replication_data2.rds")

&gt; alldata3 &lt;- read_rds("replication_data3.rds")

&gt; cm &lt;- c(weight = "ln(TC connections)")

&gt; mod_all0 &lt;- feols(logtrade ~ weight | dyad_id + cty_1 + 
+     cty_2 + year, cluster = "dyad_id+year", data = alldata1)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 7,242 observations removed because of NA values (Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all1 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad | 
+     dyad_id + cty_1 + cty_2 + year, cluster = "dyad_id+year", 
+     data = alldata1)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 62,943 observations removed because of NA values (RHS: 62,943, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all2 &lt;- feols(logtrade ~ weight + patents_cty_1 + 
+     patents_cty_2 + fta_wto + wto_dyad | dyad_id + cty_1 + cty_2 + 
+     year, cluster = " ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 180,053 observations removed because of NA values (RHS: 180,053, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all3 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad + 
+     dem_dyad + pta + comcur | dyad_id + cty_1 + cty_2 + year, 
+     cluster = "dyad_i ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 70,035 observations removed because of NA values (RHS: 70,035, Fixed-effects: 4,653).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all4 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad + 
+     dem_dyad + pta + comcur + alliance + rivalry | dyad_id + 
+     cty_1 + cty_2 + ye .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 45,514 observations removed because of NA values (RHS: 45,514, Fixed-effects: 3,095).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; models &lt;- list(mod_all0, mod_all1, mod_all2, mod_all3, 
+     mod_all4)

&gt; names(models) &lt;- c("Baseline", "Gravity", "Gravity+R&amp;D", 
+     "Gravity+", "Gravity++")

&gt; rows &lt;- tibble::tribble(~start, ~mod_all0, ~mod_all1, 
+     ~mod_all2, ~mod_all3, ~mod_all4, "Controls", "No", "Gravity", 
+     "Gravity+R&amp;D", "Gr ..." ... [TRUNCATED] 

&gt; tabsummary &lt;- modelsummary(models, fmt = 3, coef_map = cm, 
+     stars = TRUE, gof_omit = "AIC|BIC|Within|Std.Errors|R2|FE", 
+     notes = c("Fixe ..." ... [TRUNCATED] 

&gt; tabsummary %&gt;% add_header_above(c(` ` = 1, `Dependent variable: ln(Dyadic trade) (UN Comtrade)` = 5)) %&gt;% 
+     kable_styling(font_size = 8, full_w .... [TRUNCATED] 
&lt;table style="NAborder-bottom: 0; width: auto !important; margin-left: auto; margin-right: auto; font-size: 8px; width: auto !important; margin-left: auto; margin-right: auto;" class="table table"&gt;
 &lt;thead&gt;
&lt;tr&gt;
&lt;th style="empty-cells: hide;border-bottom:hidden;" colspan="1"&gt;&lt;/th&gt;
&lt;th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="5"&gt;&lt;div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; "&gt;Dependent variable: ln(Dyadic trade) (UN Comtrade)&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
  &lt;tr&gt;
   &lt;th style="text-align:left;"&gt;   &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Baseline &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+ &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity++ &lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; ln(TC connections) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.073*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.084*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.057*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.036* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.031 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.014) &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.017) &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.013) &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.016) &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.019) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Num.Obs. &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 402385 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 346684 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 229574 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 190173 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 125511 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; RMSE &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.38 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.38 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.26 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.25 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.14 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Controls &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; No &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity++ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Time series &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2015 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2011 &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;tfoot&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; + p &amp;lt; 0.1, * p &amp;lt; 0.05, ** p &amp;lt; 0.01, *** p &amp;lt; 0.001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Fixed effects by dyad, country and year, clustered standard errors by dyad and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Zero imputation on dyads with missing on TC connections.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Gravity controls: GDP, population, distance between capitals, common language, regional trade agreement, WTO dyad.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Gravity+R&amp;amp;D controls: Adds to Gravity patents per country.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Gravity+ controls: Adds to Gravity+ democratic dyad, preferential trade agreement, common currency.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Gravity++ controls: Adds to Gravity++ strategic rivalry, alliance.&lt;/td&gt;&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;/table&gt;</code></pre>
</div>
</div>
</section>
<section id="appendix-c" class="level1">
<h1>Appendix C</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb50"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb50-1"><a href="#cb50-1" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">spin</span>(<span class="st">"Appendix_C.R"</span>, <span class="at">knit =</span> <span class="cn">FALSE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "Appendix_C.Rmd"</code></pre>
</div>
<div class="sourceCode cell-code" id="cb52"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb52-1"><a href="#cb52-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="st">"Appendix_C.R"</span>, <span class="at">echo =</span> <span class="cn">TRUE</span>, <span class="at">print.eval =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; pacman::p_load(tidyverse, wayback, DBI, RSQLite, officer, 
+     pdftools, rvest)

&gt; con &lt;- dbConnect(RSQLite::SQLite(), "iso_standards.sqlite")

&gt; participation &lt;- dbReadTable(con, "participants")

&gt; liaison &lt;- dbReadTable(con, "liaison")

&gt; dbDisconnect(con)

&gt; participation %&gt;% group_by(country, membership, year, 
+     impute) %&gt;% count() %&gt;% mutate(year = as.numeric(year)) %&gt;% 
+     filter(membership != .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output-display">
<p><img src="Logfile_files/figure-html/appendixC-1.png" class="img-fluid" width="672"></p>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; liaison %&gt;% group_by(name, type, year, impute) %&gt;% 
+     count() %&gt;% mutate(type = ifelse(is.na(type), "Unknown", 
+     type)) %&gt;% mutate(year = a .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; val_participating_tc34sc3 &lt;- pptx_summary(read_pptx(path = "./report_2016_TC_34_SC_3.pptx"))[42, 
+     ][1] %&gt;% str_split(",") %&gt;% tibble() %&gt;% unn .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: `cols` is now required when using `unnest()`.
ℹ Please use `cols = c(.)`.</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Expected 2 pieces. Additional pieces discarded in 3 rows [1, 6, 13].</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Expected 2 pieces. Missing pieces filled with `NA` in 3 rows [8, 11,
24].</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; orig_participating_tc34sc3 &lt;- participation %&gt;% filter(committee == 
+     "TC 34/SC 3", year == 2016, membership %in% c("P-member"))

&gt; tc34sc3_2016_p_false_negative &lt;- val_participating_tc34sc3 %&gt;% 
+     mutate(correct = ifelse(country %in% orig_participating_tc34sc3$country, 
+    .... [TRUNCATED] 

&gt; tc34sc3_2016_p_false_positive &lt;- orig_participating_tc34sc3 %&gt;% 
+     anti_join(val_participating_tc34sc3)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(country)`</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; val_observing_tc34sc3 &lt;- pptx_summary(read_pptx(path = "./report_2016_TC_34_SC_3.pptx"))[54, 
+     ][1] %&gt;% str_split(",") %&gt;% tibble() %&gt;% unnest( .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: `cols` is now required when using `unnest()`.
ℹ Please use `cols = c(.)`.</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Expected 2 pieces. Additional pieces discarded in 6 rows [3, 6, 19, 20, 33,
43].</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Expected 2 pieces. Missing pieces filled with `NA` in 2 rows [27, 44].</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; orig_observing_tc34sc3 &lt;- participation %&gt;% filter(committee == 
+     "TC 34/SC 3", year == 2016, membership %in% c("O-member"))

&gt; tc34sc3_2016_o_false_negative &lt;- val_observing_tc34sc3 %&gt;% 
+     mutate(correct = ifelse(country %in% orig_observing_tc34sc3$country, 
+         1, .... [TRUNCATED] 

&gt; tc34sc3_2016_o_false_positive &lt;- orig_observing_tc34sc3 %&gt;% 
+     anti_join(val_observing_tc34sc3)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(country)`</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; val_file_tc146_sc2 &lt;- pdf_text("./report_2016_TC_146_SC_2.pdf")[7] %&gt;% 
+     str_split("\n")

&gt; val_participating_tc146sc2 &lt;- val_file_tc146_sc2[[1]][23:32] %&gt;% 
+     str_replace_all(",", "") %&gt;% str_replace_all("\\b[a-z]+\\s+", 
+     "") %&gt;% .... [TRUNCATED] 

&gt; orig_participating_tc146sc2 &lt;- participation %&gt;% filter(committee == 
+     "TC 146/SC 2", year == 2016, membership %in% c("P-member"))

&gt; tc146sc2_2016_p_false_negative &lt;- val_participating_tc146sc2 %&gt;% 
+     mutate(correct = ifelse(country %in% orig_participating_tc146sc2$country, 
+ .... [TRUNCATED] 

&gt; tc146sc2_2016_p_false_positive &lt;- orig_participating_tc146sc2 %&gt;% 
+     anti_join(val_participating_tc146sc2)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(country)`</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; val_observing_tc146sc2 &lt;- val_file_tc146_sc2[[1]][39:46] %&gt;% 
+     str_replace_all(",", "") %&gt;% str_replace_all("\\b[a-z]+\\s+", 
+     "") %&gt;% str .... [TRUNCATED] 

&gt; orig_observing_tc146sc2 &lt;- participation %&gt;% filter(committee == 
+     "TC 146/SC 2", year == 2016, membership %in% c("O-member"))

&gt; tc146sc2_2016_o_false_negative &lt;- val_observing_tc146sc2 %&gt;% 
+     mutate(correct = ifelse(country %in% orig_observing_tc146sc2$country, 
+         .... [TRUNCATED] 

&gt; tc146sc2_2016_o_false_positive &lt;- orig_observing_tc146sc2 %&gt;% 
+     anti_join(val_observing_tc146sc2)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(country)`</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; val_file_tc258 &lt;- pdf_text("./report_2019_TC_258.pdf")[2] %&gt;% 
+     str_split("\n")

&gt; val_participating_tc258 &lt;- val_file_tc258[[1]][7:11] %&gt;% 
+     str_replace_all(",", "") %&gt;% str_replace_all("\\b[a-z]+\\s+", 
+     "") %&gt;% str_rep .... [TRUNCATED] 

&gt; orig_participating_tc258 &lt;- participation %&gt;% filter(committee == 
+     "TC 258", year == 2019, membership %in% c("P-member"))

&gt; tc258_2019_p_false_negative &lt;- val_participating_tc258 %&gt;% 
+     mutate(correct = ifelse(country %in% orig_participating_tc258$country, 
+          .... [TRUNCATED] 

&gt; tc258_2019_p_false_positive &lt;- orig_participating_tc258 %&gt;% 
+     anti_join(val_participating_tc258)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(country)`</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; val_observing_tc258 &lt;- val_file_tc258[[1]][13:16] %&gt;% 
+     str_replace_all(",", "") %&gt;% str_replace_all("\\b[a-z]+\\s+", 
+     "") %&gt;% str_replac .... [TRUNCATED] 

&gt; orig_observing_tc258 &lt;- participation %&gt;% filter(committee == 
+     "TC 258", year == 2019, membership %in% c("O-member"))

&gt; tc258_2019_o_false_negative &lt;- orig_observing_tc258 %&gt;% 
+     mutate(correct = ifelse(country %in% orig_observing_tc258$country, 
+         1, 0))

&gt; tc258_2019_o_false_positive &lt;- orig_observing_tc258 %&gt;% 
+     anti_join(val_observing_tc258)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(country)`</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; val_file_tc211 &lt;- pdf_text("./UN_report_2002_TC_211.pdf")[3] %&gt;% 
+     str_split("\n")

&gt; val_participating_tc211 &lt;- val_file_tc211[[1]][17:26] %&gt;% 
+     str_split("    ") %&gt;% do.call(c, .) %&gt;% stringi::stri_remove_empty() %&gt;% 
+     str .... [TRUNCATED] 

&gt; orig_participating_tc211 &lt;- participation %&gt;% filter(committee == 
+     "TC 211", year == 2003, membership %in% c("P-member"))

&gt; tc211_2002_p_false_negative &lt;- val_participating_tc211 %&gt;% 
+     mutate(correct = ifelse(country %in% orig_participating_tc211$country, 
+          .... [TRUNCATED] 

&gt; tc211_2002_p_false_positive &lt;- orig_participating_tc211 %&gt;% 
+     anti_join(val_participating_tc211)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(country)`</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; val_observing_tc211 &lt;- val_file_tc211[[1]][31:39] %&gt;% 
+     str_split("    ") %&gt;% do.call(c, .) %&gt;% stringi::stri_remove_empty() %&gt;% 
+     str_squ .... [TRUNCATED] 

&gt; orig_observing_tc211 &lt;- participation %&gt;% filter(committee == 
+     "TC 211", year == 2002, membership %in% c("O-member"))

&gt; tc211_2002_o_false_negative &lt;- val_observing_tc211 %&gt;% 
+     mutate(correct = ifelse(country %in% orig_observing_tc211$country, 
+         1, 0))

&gt; tc211_2002_o_false_positive &lt;- orig_observing_tc211 %&gt;% 
+     anti_join(val_observing_tc211)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(country)`</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; val_file_207 &lt;- pdf_text("./report_2010_TC_207.pdf")[7] %&gt;% 
+     str_split("\n") %&gt;% do.call(c, .) %&gt;% str_remove_all("\\( [A-Z]+ ([A-Z]+ )?\\)")  .... [TRUNCATED] 

&gt; val_participating_tc207 = c(val_file_207$participating1, 
+     val_file_207$participating2) %&gt;% na.omit() %&gt;% as.character() %&gt;% 
+     tibble() %&gt; .... [TRUNCATED] 

&gt; orig_participating_tc207 &lt;- participation %&gt;% filter(committee == 
+     "TC 207", year == 2009, membership %in% c("P-member"))

&gt; tc207_2010_p_false_negative &lt;- val_participating_tc207 %&gt;% 
+     mutate(correct = ifelse(country %in% orig_participating_tc207$country, 
+          .... [TRUNCATED] 

&gt; tc207_2010_p_false_positive &lt;- orig_participating_tc207 %&gt;% 
+     anti_join(val_participating_tc207)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(country)`</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; val_observing_tc207 = c(val_file_207$observing) %&gt;% 
+     na.omit() %&gt;% as.character() %&gt;% tibble() %&gt;% rename(country = ".")

&gt; orig_observing_tc207 &lt;- participation %&gt;% filter(committee == 
+     "TC 207", year == 2009, membership %in% c("O-member"))

&gt; tc207_2010_o_false_negative &lt;- val_observing_tc207 %&gt;% 
+     mutate(correct = ifelse(country %in% orig_observing_tc207$country, 
+         1, 0))

&gt; tc207_2010_o_false_positive &lt;- orig_observing_tc207 %&gt;% 
+     anti_join(val_observing_tc207)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(country)`</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Logfile_files/figure-html/appendixC-2.png" class="img-fluid" width="672"></p>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; make_accuracy &lt;- function(false_negative, false_positive) {
+     correct_count &lt;- false_negative %&gt;% count(correct)
+     false_positive_count &lt;- f .... [TRUNCATED] 

&gt; tc34sc3_2016_p &lt;- tibble(committee = "TC 34/SC 3", 
+     year = 2016, membership = "P-member", false_negative = tc34sc3_2016_p_false_negative %&gt;% 
 .... [TRUNCATED] 

&gt; tc34sc3_2016_o &lt;- tibble(committee = "TC 34/SC 3", 
+     year = 2016, membership = "O-member", false_negative = tc34sc3_2016_o_false_negative %&gt;% 
 .... [TRUNCATED] 

&gt; tc146sc2_2016_p &lt;- tibble(committee = "TC 146/SC 2", 
+     year = 2016, membership = "P-member", false_negative = 0, 
+     false_positive = tc146s .... [TRUNCATED] 

&gt; tc146sc2_2016_o &lt;- tibble(committee = "TC 146/SC 2", 
+     year = 2016, membership = "O-member", false_negative = 0, 
+     false_positive = tc146s .... [TRUNCATED] 

&gt; tc258_2019_p &lt;- tibble(committee = "TC 258", year = 2019, 
+     membership = "P-member", false_negative = tc258_2019_p_false_negative %&gt;% 
+        .... [TRUNCATED] 

&gt; tc258_2019_o &lt;- tibble(committee = "TC 258", year = 2019, 
+     membership = "O-member", false_negative = 0, false_positive = tc258_2019_o_false_po .... [TRUNCATED] 

&gt; tc211_2002_p &lt;- tibble(committee = "TC 211", year = 2002, 
+     membership = "P-member", false_negative = tc211_2002_p_false_negative %&gt;% 
+        .... [TRUNCATED] 

&gt; tc211_2002_o &lt;- tibble(committee = "TC 211", year = 2002, 
+     membership = "O-member", false_negative = tc211_2002_o_false_negative %&gt;% 
+        .... [TRUNCATED] 

&gt; tc201_2010_p &lt;- tibble(committee = "TC 207", year = 2010, 
+     membership = "P-member", false_negative = tc207_2010_p_false_negative %&gt;% 
+        .... [TRUNCATED] 

&gt; tc201_2010_o &lt;- tibble(committee = "TC 207", year = 2010, 
+     membership = "O-member", false_negative = tc207_2010_o_false_negative %&gt;% 
+        .... [TRUNCATED] 

&gt; bind_rows(tc211_2002_p, tc211_2002_o, tc201_2010_p, 
+     tc201_2010_o, tc146sc2_2016_p, tc146sc2_2016_o, tc34sc3_2016_p, 
+     tc34sc3_2016_o, tc .... [TRUNCATED] 
&lt;table class="table" style="font-size: 12px; margin-left: auto; margin-right: auto;"&gt;
 &lt;thead&gt;
  &lt;tr&gt;
   &lt;th style="text-align:left;"&gt; Technical committee &lt;/th&gt;
   &lt;th style="text-align:right;"&gt; Year &lt;/th&gt;
   &lt;th style="text-align:left;"&gt; Membership &lt;/th&gt;
   &lt;th style="text-align:right;"&gt; False negative &lt;/th&gt;
   &lt;th style="text-align:right;"&gt; False positive &lt;/th&gt;
   &lt;th style="text-align:right;"&gt; Accuracy &lt;/th&gt;
   &lt;th style="text-align:right;"&gt; Countries in committee &lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; TC 211 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2002 &lt;/td&gt;
   &lt;td style="text-align:left;"&gt; P-member &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 23 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 0 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 20.69 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 6 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; TC 211 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2002 &lt;/td&gt;
   &lt;td style="text-align:left;"&gt; O-member &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 17 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 0 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 37.04 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 10 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; TC 207 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2010 &lt;/td&gt;
   &lt;td style="text-align:left;"&gt; P-member &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 6 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 89.33 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 73 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; TC 207 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2010 &lt;/td&gt;
   &lt;td style="text-align:left;"&gt; O-member &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 3 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 83.33 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 33 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; TC 146/SC 2 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2016 &lt;/td&gt;
   &lt;td style="text-align:left;"&gt; P-member &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 0 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 0 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 100.00 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 23 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; TC 146/SC 2 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2016 &lt;/td&gt;
   &lt;td style="text-align:left;"&gt; O-member &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 0 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 88.89 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 18 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; TC 34/SC 3 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2016 &lt;/td&gt;
   &lt;td style="text-align:left;"&gt; P-member &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 1 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 1 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 91.67 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 23 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; TC 34/SC 3 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2016 &lt;/td&gt;
   &lt;td style="text-align:left;"&gt; O-member &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 1 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 94.23 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 51 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; TC 258 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2019 &lt;/td&gt;
   &lt;td style="text-align:left;"&gt; P-member &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 4 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 6 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 75.61 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 37 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; TC 258 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2019 &lt;/td&gt;
   &lt;td style="text-align:left;"&gt; O-member &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 0 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 2 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 87.50 &lt;/td&gt;
   &lt;td style="text-align:right;"&gt; 14 &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&gt; us_secretariat &lt;- read_rds("Appendix_C_Data_USsecretariat.rds")

&gt; us_secretariat_validation &lt;- us_secretariat %&gt;% mutate(committee = str_remove(committee, 
+     "ISO/"), committee = str_remove(committee, "IEC "))  .... [TRUNCATED] 

&gt; us_secretariat_original &lt;- participation %&gt;% filter(country == 
+     "United States", membership == "Secretariat") %&gt;% mutate(committee_year = str_ .... [TRUNCATED] 

&gt; us_validation1 &lt;- us_secretariat_validation %&gt;% mutate(Captured = factor(ifelse(committee_year %in% 
+     us_secretariat_original$committee_year, 1 .... [TRUNCATED] 

&gt; us_validation1 %&gt;% mutate(Captured = ifelse(Captured == 
+     0, "No", ifelse(Captured == 1, "Yes", Captured))) %&gt;% ggplot(aes(year, 
+     committ .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; us_validation1 %&gt;% count(Captured) %&gt;% spread(Captured, 
+     n) %&gt;% mutate(percent = `1`/(`0` + `1`) * 100)
# A tibble: 1 × 3
    `0`   `1` percent
  &lt;int&gt; &lt;int&gt;   &lt;dbl&gt;
1   288  1065    78.7

&gt; con &lt;- dbConnect(RSQLite::SQLite(), "iso_standards.sqlite")

&gt; tc_creation &lt;- dbReadTable(con, "historical_tc_creation")

&gt; tc_creation &lt;- tc_creation %&gt;% rename(year_original = year)

&gt; dbDisconnect(con)

&gt; ref_table &lt;- pdf_text("./ValidationData/report_2000.pdf")[42:52] %&gt;% 
+     read_lines() %&gt;% grep("^TC", ., value = TRUE) %&gt;% paste(collapse = "\n") .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Rows: 175 Columns: 4
── Column specification ────────────────────────────────────────────────────────

chr (4): X1, X2, X3, X4

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Logfile_files/figure-html/appendixC-3.png" class="img-fluid" width="672"></p>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; joined &lt;- left_join(tc_creation, ref_table, by = join_by(committee))

&gt; joined %&gt;% mutate(diff = year_original - year_validation) %&gt;% 
+     summarise(year_diff = mean(diff, na.rm = T))
  year_diff
1 0.1351351

&gt; joined %&gt;% select(year_original, year_validation) %&gt;% 
+     mutate(diff = year_original - year_validation) %&gt;% na.omit() %&gt;% 
+     ggplot(aes(year .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output-display">
<p><img src="Logfile_files/figure-html/appendixC-4.png" class="img-fluid" width="672"></p>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; joined %&gt;% mutate(ok = ifelse(year_original - year_validation, 
+     0, 1)) %&gt;% count(ok)
  ok   n
1  0  28
2  1 268
3 NA 802

&gt; joined %&gt;% mutate(ok = ifelse(year_original - year_validation, 
+     0, 1)) %&gt;% filter(ok == 0) %&gt;% mutate(diff = year_original - 
+     year_valid .... [TRUNCATED] 
  year_diff
1  1.428571

&gt; joined %&gt;% mutate(ok = ifelse(year_original - year_validation, 
+     0, 1)) %&gt;% filter(ok == 0) %&gt;% mutate(diff = year_original - 
+     year_valid .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output-display">
<p><img src="Logfile_files/figure-html/appendixC-5.png" class="img-fluid" width="672"></p>
</div>
</div>
</section>
<section id="appendix-d" class="level1">
<h1>Appendix D</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb88"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb88-1"><a href="#cb88-1" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">spin</span>(<span class="st">"Appendix_D.R"</span>, <span class="at">knit =</span> <span class="cn">FALSE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "Appendix_D.Rmd"</code></pre>
</div>
<div class="sourceCode cell-code" id="cb90"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb90-1"><a href="#cb90-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="st">"Appendix_D.R"</span>, <span class="at">echo =</span> <span class="cn">TRUE</span>, <span class="at">print.eval =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; pacman::p_load(tidyverse, wbstats, DBI, RSQLite, countrycode, 
+     modelsummary, fixest, kableExtra)

&gt; GDP &lt;- wb_data("NY.GDP.MKTP.CD", start_date = 1990, 
+     end_date = 2023) %&gt;% rename(year = date) %&gt;% mutate(country = ifelse(country == 
+     "T ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `country_code = countrycode(sourcevar = country, origin =
  "country.name", destination = "iso3c")`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Channel Islands, Kosovo</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; EXP &lt;- wb_data("NE.EXP.GNFS.CD", start_date = 1990, 
+     end_date = 2023) %&gt;% rename(year = date) %&gt;% mutate(country = ifelse(country == 
+     "T ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `country_code = countrycode(sourcevar = country, origin =
  "country.name", destination = "iso3c")`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Channel Islands, Kosovo</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; POP &lt;- wb_data("SP.POP.TOTL", start_date = 1990, end_date = 2023) %&gt;% 
+     rename(year = date) %&gt;% mutate(country = ifelse(country == 
+     "Turk ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `country_code = countrycode(sourcevar = country, origin =
  "country.name", destination = "iso3c")`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Channel Islands, Kosovo</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; IND &lt;- wb_data("NV.IND.TOTL.ZS", start_date = 1990, 
+     end_date = 2023) %&gt;% rename(year = date) %&gt;% mutate(country = ifelse(country == 
+     "T ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `country_code = countrycode(sourcevar = country, origin =
  "country.name", destination = "iso3c")`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Channel Islands, Kosovo</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; ICT &lt;- wb_data("BX.GSR.CCIS.ZS", start_date = 1990, 
+     end_date = 2023) %&gt;% rename(year = date) %&gt;% mutate(country = ifelse(country == 
+     "T ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `country_code = countrycode(sourcevar = country, origin =
  "country.name", destination = "iso3c")`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Channel Islands, Kosovo</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; RND &lt;- wb_data("GB.XPD.RSDV.GD.ZS", start_date = 1990, 
+     end_date = 2023) %&gt;% rename(year = date) %&gt;% mutate(country = ifelse(country == 
+     .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `country_code = countrycode(sourcevar = country, origin =
  "country.name", destination = "iso3c")`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Channel Islands, Kosovo</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; con &lt;- dbConnect(RSQLite::SQLite(), "iso_standards.sqlite")

&gt; country_certifications &lt;- dbReadTable(con, "country_certifications") %&gt;% 
+     mutate(country = ifelse(country == "Russion Federation", 
+          .... [TRUNCATED] 

&gt; dbDisconnect(con)

&gt; cert_agg &lt;- country_certifications %&gt;% mutate(continent = countrycode(sourcevar = country, 
+     origin = "country.name", destination = "un.region. ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `continent = countrycode(sourcevar = country, origin =
  "country.name", destination = "un.region.name")`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Kosovo, Netherlands Antilles, Taiwan</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; certifications &lt;- cert_agg %&gt;% mutate(year = as.numeric(year)) %&gt;% 
+     select(-iso_name) %&gt;% filter(iso %in% c("iso_9001", "iso_14001", 
+     "i ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `country_code = countrycode(sourcevar = country, origin =
  "country.name", destination = "iso3c")`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Kosovo, Netherlands Antilles</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in left_join(., GDP %&gt;% select(country_code, year, NY.GDP.MKTP.CD) %&gt;% : Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 1107 of `x` matches multiple rows in `y`.
ℹ Row 1160 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship =
  "many-to-many"` to silence this warning.</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in left_join(., EXP %&gt;% select(country_code, year, NE.EXP.GNFS.CD) %&gt;% : Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 3164 of `x` matches multiple rows in `y`.
ℹ Row 1160 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship =
  "many-to-many"` to silence this warning.</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in left_join(., POP %&gt;% select(country_code, year, SP.POP.TOTL) %&gt;% : Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 97 of `x` matches multiple rows in `y`.
ℹ Row 1357 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship =
  "many-to-many"` to silence this warning.</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in left_join(., IND %&gt;% select(country_code, year, NV.IND.TOTL.ZS) %&gt;% : Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 3214 of `x` matches multiple rows in `y`.
ℹ Row 1160 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship =
  "many-to-many"` to silence this warning.</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in left_join(., ICT %&gt;% select(country_code, year, BX.GSR.CCIS.ZS) %&gt;% : Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 2365 of `x` matches multiple rows in `y`.
ℹ Row 1160 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship =
  "many-to-many"` to silence this warning.</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; cert_data &lt;- certifications %&gt;% mutate(gdp_bill = NY.GDP.MKTP.CD/100000000) %&gt;% 
+     mutate(I9GDP = iso_9001/gdp_bill) %&gt;% mutate(I14GDP = iso_140 .... [TRUNCATED] 

&gt; mod1 &lt;- feols(I14GDP ~ lag(I9GDP, 1) + GDPPOP + log(EXPGDP) + 
+     IND | country + year, cluster = "country+year", data = cert_data %&gt;% 
+     fil .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 1,538 observations removed because of NA values (LHS: 527, RHS: 1,534).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod2 &lt;- feols(I27GDP ~ lag(I9GDP, 1) + GDPPOP + log(EXPGDP) + 
+     IND | country + year, cluster = "country+year", data = cert_data %&gt;% 
+     fil .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 1,514 observations removed because of NA values (LHS: 1,005, RHS: 1,160).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod3 &lt;- feols(I27GDP ~ lag(I14GDP, 1) + lag(I9GDP, 
+     1) + GDPPOP + log(EXPGDP) + IND | country + year, cluster = "country+year", 
+     data =  .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 1,514 observations removed because of NA values (LHS: 1,005, RHS: 1,164).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; cm &lt;- c(`lag(I9GDP, 1)` = "Certification in ISO 9001 (1 year lag)", 
+     `lag(I14GDP, 1)` = "Certification in ISO 14001 (1 year lag)", 
+     ICT  .... [TRUNCATED] 

&gt; models &lt;- list(mod1, mod2, mod3)

&gt; names(models) &lt;- c("ISO 14001", "ISO 27001", "ISO 27001")

&gt; rows &lt;- tibble::tribble(~start, ~mod1, ~mod2, ~mod3, 
+     "Fixed effects", "Yes", "Yes", "Yes", "Time series", "1999-2022", 
+     "2006-2022", "2 ..." ... [TRUNCATED] 

&gt; tabsummary &lt;- modelsummary(models, fmt = 3, coef_map = cm, 
+     stars = TRUE, statistic = c("{std.error}"), gof_omit = "AIC|BIC|Within|Std.Errors| ..." ... [TRUNCATED] 

&gt; tabsummary %&gt;% add_header_above(c(` ` = 1, `Dependent variable: Certifications` = 3)) %&gt;% 
+     kable_styling(font_size = 10, full_width = FALSE)
&lt;table style="NAborder-bottom: 0; width: auto !important; margin-left: auto; margin-right: auto; font-size: 10px; width: auto !important; margin-left: auto; margin-right: auto;" class="table table"&gt;
 &lt;thead&gt;
&lt;tr&gt;
&lt;th style="empty-cells: hide;border-bottom:hidden;" colspan="1"&gt;&lt;/th&gt;
&lt;th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="3"&gt;&lt;div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; "&gt;Dependent variable: Certifications&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
  &lt;tr&gt;
   &lt;th style="text-align:left;"&gt;   &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; &nbsp;ISO 14001 &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; &nbsp;ISO 27001 &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; &nbsp;ISO 27001  &lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Certification in ISO 9001 (1 year lag) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.160** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.009 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.011* &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.042 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.006 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.004 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Certification in ISO 14001 (1 year lag) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.101*** &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.020 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; GDP per capita &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 209.847 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 4.504 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 7.461 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 153.321 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 14.408 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 10.676 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Exports per GDP (ln) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.218*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.062** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.036** &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.056 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.016 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.009 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Industry value added (% of GDP) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.004* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.001 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.000 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; 0.002 &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; 0.000 &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; 0.000 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Num.Obs. &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 3769 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2321 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2321 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; RMSE &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.24 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.04 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.03 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Fixed effects &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Yes &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Yes &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Yes &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Time series &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1999-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2006-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2006-2022 &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;tfoot&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; + p &amp;lt; 0.1, * p &amp;lt; 0.05, ** p &amp;lt; 0.01, *** p &amp;lt; 0.001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Fixed effects: Country and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Clustered standard errors by country and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Model: OLS&lt;/td&gt;&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;/table&gt;
&gt; mod1 &lt;- feols(I14GDP ~ lag(I9GDP_cum, 1) + GDPPOP + 
+     log(EXPGDP) + IND | country + year, cluster = "country+year", 
+     data = cert_data %&gt;% .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 1,536 observations removed because of NA values (LHS: 527, RHS: 1,471).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod2 &lt;- feols(I27GDP_cum ~ lag(I9GDP_cum, 1) + GDPPOP + 
+     log(EXPGDP) + IND | country + year, cluster = "country+year", 
+     data = cert_data .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 1,097 observations removed because of NA values (LHS: 358, RHS: 1,097).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod3 &lt;- feols(I27GDP_cum ~ lag(I14GDP_cum, 1) + lag(I9GDP_cum, 
+     1) + GDPPOP + log(EXPGDP) + IND | country + year, cluster = "country+year", 
+ .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 1,097 observations removed because of NA values (LHS: 358, RHS: 1,097).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; cm &lt;- c(`lag(I9GDP_cum, 1)` = "Cumulative certification in ISO 9001 (1 year lag)", 
+     `lag(I14GDP_cum, 1)` = "Cumulative certification in ISO 14 ..." ... [TRUNCATED] 

&gt; models &lt;- list(mod1, mod2, mod3)

&gt; names(models) &lt;- c("ISO 14001", "ISO 27001", "ISO 27001")

&gt; rows &lt;- tibble::tribble(~start, ~mod1, ~mod2, ~mod3, 
+     "Fixed effects", "Yes", "Yes", "Yes", "Time series", "1999-2022", 
+     "2006-2022", "2 ..." ... [TRUNCATED] 

&gt; tabsummary &lt;- modelsummary(models, fmt = 3, coef_map = cm, 
+     stars = TRUE, statistic = c("{std.error}"), gof_omit = "AIC|BIC|Within|Std.Errors| ..." ... [TRUNCATED] 

&gt; tabsummary %&gt;% add_header_above(c(` ` = 1, `Dependent variable: Certifications` = 3)) %&gt;% 
+     kable_styling(font_size = 10, full_width = FALSE)
&lt;table style="NAborder-bottom: 0; width: auto !important; margin-left: auto; margin-right: auto; font-size: 10px; width: auto !important; margin-left: auto; margin-right: auto;" class="table table"&gt;
 &lt;thead&gt;
&lt;tr&gt;
&lt;th style="empty-cells: hide;border-bottom:hidden;" colspan="1"&gt;&lt;/th&gt;
&lt;th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="3"&gt;&lt;div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; "&gt;Dependent variable: Certifications&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
  &lt;tr&gt;
   &lt;th style="text-align:left;"&gt;   &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; &nbsp;ISO 14001 &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; &nbsp;ISO 27001 &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; &nbsp;ISO 27001  &lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Cumulative certification in ISO 9001 (1 year lag) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.023*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.024*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.001 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.003 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.005 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.005 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Cumulative certification in ISO 14001 (1 year lag) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.088*** &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.015 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; GDP per capita &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −39.572 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 192.486 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 95.479 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 50.684 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 120.404 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 66.618 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Exports per GDP (ln) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.053 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.027 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.012 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.031 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.033 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.025 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Industry value added (% of GDP) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.001 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.001 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.001+ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; 0.001 &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; 0.001 &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; 0.001 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Num.Obs. &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 3771 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2738 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2738 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; RMSE &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.21 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.14 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.12 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Fixed effects &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Yes &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Yes &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Yes &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Time series &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1999-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2006-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2006-2022 &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;tfoot&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; + p &amp;lt; 0.1, * p &amp;lt; 0.05, ** p &amp;lt; 0.01, *** p &amp;lt; 0.001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Fixed effects: Country and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Clustered standard errors by country and year.&lt;/td&gt;&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;/table&gt;</code></pre>
</div>
</div>
</section>
<section id="appendix-e" class="level1">
<h1>Appendix E</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb125"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb125-1"><a href="#cb125-1" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">spin</span>(<span class="st">"Appendix_E.R"</span>, <span class="at">knit =</span> <span class="cn">FALSE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "Appendix_E.Rmd"</code></pre>
</div>
<div class="sourceCode cell-code" id="cb127"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb127-1"><a href="#cb127-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="st">"Appendix_E.R"</span>, <span class="at">echo =</span> <span class="cn">TRUE</span>, <span class="at">print.eval =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; pacman::p_load(tidyverse, wbstats, DBI, RSQLite, countrycode, 
+     patentsview, purrr, modelsummary, fixest, kableExtra)

&gt; GDP &lt;- wb_data("NY.GDP.MKTP.CD", start_date = 1990, 
+     end_date = 2023) %&gt;% rename(year = date) %&gt;% mutate(country = ifelse(country == 
+     "T ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `country_code = countrycode(sourcevar = country, origin =
  "country.name", destination = "iso3c")`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Channel Islands, Kosovo</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; EXP &lt;- wb_data("NE.EXP.GNFS.CD", start_date = 1990, 
+     end_date = 2023) %&gt;% rename(year = date) %&gt;% mutate(country = ifelse(country == 
+     "T ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `country_code = countrycode(sourcevar = country, origin =
  "country.name", destination = "iso3c")`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Channel Islands, Kosovo</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; POP &lt;- wb_data("SP.POP.TOTL", start_date = 1990, end_date = 2023) %&gt;% 
+     rename(year = date) %&gt;% mutate(country = ifelse(country == 
+     "Turk ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `country_code = countrycode(sourcevar = country, origin =
  "country.name", destination = "iso3c")`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Channel Islands, Kosovo</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; IND &lt;- wb_data("NV.IND.TOTL.ZS", start_date = 1990, 
+     end_date = 2023) %&gt;% rename(year = date) %&gt;% mutate(country = ifelse(country == 
+     "T ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `country_code = countrycode(sourcevar = country, origin =
  "country.name", destination = "iso3c")`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Channel Islands, Kosovo</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; ICT &lt;- wb_data("BX.GSR.CCIS.ZS", start_date = 1990, 
+     end_date = 2023) %&gt;% rename(year = date) %&gt;% mutate(country = ifelse(country == 
+     "T ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `country_code = countrycode(sourcevar = country, origin =
  "country.name", destination = "iso3c")`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Channel Islands, Kosovo</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; con &lt;- dbConnect(RSQLite::SQLite(), "iso_standards.sqlite")

&gt; participation &lt;- dbReadTable(con, "participants")

&gt; memberships &lt;- participation %&gt;% mutate(country = countrycode::countrycode(sourcevar = country, 
+     origin = "country.name", destination = "count ..." ... [TRUNCATED] 

&gt; all_sectors &lt;- memberships %&gt;% drop_na(sector) %&gt;% 
+     pull(sector) %&gt;% unique()

&gt; dbDisconnect(con)

&gt; patents_tech &lt;- read_rds("Appendix_E_Data_Patentstech.rds")

&gt; country &lt;- patents_tech %&gt;% select(patent_number, 
+     patent_year, assignees) %&gt;% unnest(assignees) %&gt;% select(patent_number, 
+     patent_year, .... [TRUNCATED] 

&gt; patents &lt;- patents_tech %&gt;% select(patent_number, 
+     patent_year, patent_title, patent_date, tech_area) %&gt;% distinct(patent_number, 
+     paten .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in left_join(., country, by = join_by(patent_number, patent_year)): Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 333 of `x` matches multiple rows in `y`.
ℹ Row 25 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship =
  "many-to-many"` to silence this warning.</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; member_patents &lt;- patents %&gt;% left_join(memberships %&gt;% 
+     filter(committee %in% c("JTC 1")) %&gt;% mutate(membership = ifelse(membership == 
+     .... [TRUNCATED] 

&gt; member_patents_count &lt;- member_patents %&gt;% group_by(year, 
+     country) %&gt;% summarise(patents_count = sum(share)) %&gt;% ungroup()</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>`summarise()` has grouped output by 'year'. You can override using the
`.groups` argument.</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; member_patents_enter &lt;- member_patents %&gt;% mutate(committee_member = ifelse(!is.na(committee), 
+     1, 0)) %&gt;% select(year, country, committee_mem .... [TRUNCATED] 

&gt; mod1 &lt;- fepois(patents_count ~ committee_member + 
+     GDPPOP + log(EXPGDP) + IND + ICT | country + year, cluster = "country+year", 
+     data =  .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 1,263 observations removed because of NA values (LHS: 991, RHS: 682).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod2 &lt;- fepois(patents_count ~ membership + GDPPOP + 
+     log(EXPGDP) + IND + ICT | country + year, cluster = "country+year", 
+     data = member .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 510 observations removed because of NA values (LHS: 428, RHS: 179).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; cm &lt;- c(committee_member = "Membership in TC", membershipP = "P-member in TC", 
+     GDPPOP = "GDP per capita", `log(EXPPOP)` = "Exports per GDP (l ..." ... [TRUNCATED] 

&gt; models &lt;- list(mod1, mod2)

&gt; names(models) &lt;- c("TC membership", "Type of membership")

&gt; rows &lt;- tibble::tribble(~start, ~mod1, ~mod2, "Time series", 
+     "2004-2022", "2004-2022")

&gt; tabsummary &lt;- modelsummary(models, fmt = 3, coef_map = cm, 
+     stars = TRUE, statistic = c("{std.error}"), gof_omit = "AIC|BIC|Within|Std.Errors| ..." ... [TRUNCATED] 

&gt; tabsummary %&gt;% add_header_above(c(` ` = 1, `Dependent variable: Number of ICT patents` = 2)) %&gt;% 
+     kable_styling(font_size = 10, full_width = F .... [TRUNCATED] 
&lt;table style="NAborder-bottom: 0; width: auto !important; margin-left: auto; margin-right: auto; font-size: 10px; width: auto !important; margin-left: auto; margin-right: auto;" class="table table"&gt;
 &lt;thead&gt;
&lt;tr&gt;
&lt;th style="empty-cells: hide;border-bottom:hidden;" colspan="1"&gt;&lt;/th&gt;
&lt;th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="2"&gt;&lt;div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; "&gt;Dependent variable: Number of ICT patents&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
  &lt;tr&gt;
   &lt;th style="text-align:left;"&gt;   &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; TC membership &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Type of membership &lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Membership in TC &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.905** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.339 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; P-member in TC &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.324 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.223 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; GDP per capita &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.000 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.000 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.000 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.000 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Industry value added (% of GDP) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.061* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.063* &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.028 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.028 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; ICT % of service exports &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.038* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.038* &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; 0.016 &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; 0.016 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Num.Obs. &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1107 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 936 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; RMSE &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 679.85 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 739.16 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Time series &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2022 &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;tfoot&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; + p &amp;lt; 0.1, * p &amp;lt; 0.05, ** p &amp;lt; 0.01, *** p &amp;lt; 0.001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Fixed effects: Country and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Clustered standard errors by country and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Control variables (WDI data): GDP per capita, Exports, Industry value added, ICT service exports&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Model: Poisson.&lt;/td&gt;&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;/table&gt;
&gt; predict(mod1, newdata = tibble(country = c(rep("United States", 
+     2)), year = rep("2015", 2), committee_member = c(0, 1), GDPPOP = rep(mean(mem .... [TRUNCATED] 
[1]  6207.843 15349.111</code></pre>
</div>
</div>
</section>
<section id="appendix-f" class="level1">
<h1>Appendix F</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb147"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb147-1"><a href="#cb147-1" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">spin</span>(<span class="st">"Appendix_F.R"</span>, <span class="at">knit =</span> <span class="cn">FALSE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "Appendix_F.Rmd"</code></pre>
</div>
<div class="sourceCode cell-code" id="cb149"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb149-1"><a href="#cb149-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="st">"Appendix_F.R"</span>, <span class="at">echo =</span> <span class="cn">TRUE</span>, <span class="at">print.eval =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; pacman::p_load(tidyverse, fixest, modelsummary, plm, 
+     kableExtra, stevemisc, lmtest)

&gt; alldata1 &lt;- read_rds("replication_data1.rds")

&gt; alldata2 &lt;- read_rds("replication_data2.rds")

&gt; alldata3 &lt;- read_rds("replication_data3.rds")

&gt; cm &lt;- c(weight = "ln(TC connections)", patents_cty_1 = "Patents (exporter) as share of GDP", 
+     patents_cty_2 = "Patents (importer) as share of  ..." ... [TRUNCATED] 

&gt; mod_all0 &lt;- feols(log_imf_trade ~ weight | dyad_id + 
+     cty_1 + cty_2 + year, cluster = "dyad_id+year", data = alldata1)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 110,968 observations removed because of NA values (LHS: 110,968, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all1 &lt;- feols(log_imf_trade ~ weight + fta_wto + 
+     wto_dyad | dyad_id + cty_1 + cty_2 + year, cluster = "dyad_id+year", 
+     data = allda .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 110,968 observations removed because of NA values (LHS: 110,968, RHS: 62,943, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all2 &lt;- feols(log_imf_trade ~ weight + patents_cty_1 + 
+     patents_cty_2 + fta_wto + wto_dyad | dyad_id + cty_1 + cty_2 + 
+     year, cluste .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 203,997 observations removed because of NA values (LHS: 110,968, RHS: 180,053, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all3 &lt;- feols(log_imf_trade ~ weight + fta_wto + 
+     wto_dyad + dem_dyad + pta + comcur | dyad_id + cty_1 + cty_2 + 
+     year, cluster = "d ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 78,970 observations removed because of NA values (LHS: 52,455, RHS: 70,035, Fixed-effects: 4,653).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all4 &lt;- feols(log_imf_trade ~ weight + fta_wto + 
+     wto_dyad + dem_dyad + pta + comcur + alliance + rivalry | 
+     dyad_id + cty_1 + cty_2 .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 52,081 observations removed because of NA values (LHS: 34,914, RHS: 45,514, Fixed-effects: 3,095).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; models &lt;- list(mod_all0, mod_all1, mod_all2, mod_all3, 
+     mod_all4)

&gt; names(models) &lt;- c("Baseline", "Gravity", "Gravity+R&amp;D", 
+     "Gravity++", "Gravity+++")

&gt; rows &lt;- tibble::tribble(~start, ~mod_all0, ~mod_all1, 
+     ~mod_all2, ~mod_all3, ~mod_all4, "Controls", "No", "Gravity", 
+     "Gravity+R&amp;D", "Gr ..." ... [TRUNCATED] 

&gt; tabsummary &lt;- modelsummary(models, fmt = 3, coef_map = cm, 
+     stars = TRUE, statistic = c("{std.error}"), gof_omit = "AIC|BIC|Within|Std.Errors| ..." ... [TRUNCATED] 

&gt; tabsummary %&gt;% add_header_above(c(` ` = 1, `Dependent variable: ln(Dyadic trade) (IMF).` = 5)) %&gt;% 
+     kable_styling(font_size = 10, full_width = .... [TRUNCATED] 
&lt;table style="NAborder-bottom: 0; width: auto !important; margin-left: auto; margin-right: auto; font-size: 10px; width: auto !important; margin-left: auto; margin-right: auto;" class="table table"&gt;
 &lt;thead&gt;
&lt;tr&gt;
&lt;th style="empty-cells: hide;border-bottom:hidden;" colspan="1"&gt;&lt;/th&gt;
&lt;th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="5"&gt;&lt;div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; "&gt;Dependent variable: ln(Dyadic trade) (IMF).&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
  &lt;tr&gt;
   &lt;th style="text-align:left;"&gt;   &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Baseline &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity++ &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+++ &lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; ln(TC connections) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.051** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.053** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.035** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.004 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.016 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.014 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.014 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.011 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.015 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.020 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (exporter) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.013*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.003 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (importer) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.008* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.003 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Regional trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.072 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.099* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.073 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.129* &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.045 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.043 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.045 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.053 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; WTO dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.053 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.083+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.071 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.125 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.042 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.043 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.047 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.082 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Democratic dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.009 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.001 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.032 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.029 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Preferential trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.004 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.002 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.050 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.046 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Common currency &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.154* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.135 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.068 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.074 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Alliance &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.053 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.059 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Strategic rivals &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.022 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; 0.084 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Num.Obs. &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 298659 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 298659 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 205630 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 181238 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 118944 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; RMSE &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.29 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.29 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.18 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.18 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.07 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Controls &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; No &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity++ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Time series &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2015 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2011 &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;tfoot&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; + p &amp;lt; 0.1, * p &amp;lt; 0.05, ** p &amp;lt; 0.01, *** p &amp;lt; 0.001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Fixed effects: Dyad, country and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Clustered standard errors by dyad and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Zero imputation on dyads with missing on TC connections.&lt;/td&gt;&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;/table&gt;
&gt; mod_all0 &lt;- feols(share_trade ~ weight | dyad_id + 
+     cty_1 + cty_2 + year, cluster = "dyad_id+year", data = alldata1)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 7,242 observations removed because of NA values (Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all1 &lt;- feols(share_trade ~ weight + fta_wto + 
+     wto_dyad | dyad_id + cty_1 + cty_2 + year, cluster = "dyad_id+year", 
+     data = alldata .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 62,943 observations removed because of NA values (RHS: 62,943, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all2 &lt;- feols(share_trade ~ weight + patents_cty_1 + 
+     patents_cty_2 + fta_wto + wto_dyad | dyad_id + cty_1 + cty_2 + 
+     year, cluster  .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 180,053 observations removed because of NA values (RHS: 180,053, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all3 &lt;- feols(share_trade ~ weight + fta_wto + 
+     wto_dyad + dem_dyad + pta + comcur | dyad_id + cty_1 + cty_2 + 
+     year, cluster = "dya ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 70,035 observations removed because of NA values (RHS: 70,035, Fixed-effects: 4,653).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all4 &lt;- feols(share_trade ~ weight + fta_wto + 
+     wto_dyad + dem_dyad + pta + comcur + alliance + rivalry | 
+     dyad_id + cty_1 + cty_2 + .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 45,514 observations removed because of NA values (RHS: 45,514, Fixed-effects: 3,095).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; models &lt;- list(mod_all0, mod_all1, mod_all2, mod_all3, 
+     mod_all4)

&gt; names(models) &lt;- c("Baseline", "Gravity", "Gravity+R&amp;D", 
+     "Gravity++", "Gravity+++")

&gt; rows &lt;- tibble::tribble(~start, ~mod_all0, ~mod_all1, 
+     ~mod_all2, ~mod_all3, ~mod_all4, "Controls", "No", "Gravity", 
+     "Gravity+R&amp;D", "Gr ..." ... [TRUNCATED] 

&gt; tabsummary &lt;- modelsummary(models, fmt = 5, coef_map = cm, 
+     stars = TRUE, statistic = c("{std.error}"), gof_omit = "AIC|BIC|Within|Std.Errors| ..." ... [TRUNCATED] 

&gt; tabsummary %&gt;% add_header_above(c(` ` = 1, `Dependent variable: Share of trade` = 5)) %&gt;% 
+     kable_styling(font_size = 10, full_width = FALSE)
&lt;table style="NAborder-bottom: 0; width: auto !important; margin-left: auto; margin-right: auto; font-size: 10px; width: auto !important; margin-left: auto; margin-right: auto;" class="table table"&gt;
 &lt;thead&gt;
&lt;tr&gt;
&lt;th style="empty-cells: hide;border-bottom:hidden;" colspan="1"&gt;&lt;/th&gt;
&lt;th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="5"&gt;&lt;div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; "&gt;Dependent variable: Share of trade&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
  &lt;tr&gt;
   &lt;th style="text-align:left;"&gt;   &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Baseline &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity++ &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+++ &lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; ln(TC connections) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00029* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00030* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00042* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00050* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00064* &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00012 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00012 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00016 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00018 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00024 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (exporter) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.00002+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00001 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (importer) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00000 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00000 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Regional trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00043* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00052* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00052* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00062* &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00016 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00020 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00019 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00022 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; WTO dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.00011 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.00011 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00013 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00033 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00026 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00035 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00019 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Democratic dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.00004 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.00004 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00005 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00005 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Preferential trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00032 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00014 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00045 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00035 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Common currency &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.00010 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00003 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00019 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00021 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Alliance &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00233 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.00148 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Strategic rivals &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.00518+ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; 0.00254 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Num.Obs. &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 402385 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 346684 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 229574 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 190173 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 125511 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; RMSE &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.01 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.01 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.01 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.01 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.01 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Controls &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; No &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity++ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Time series &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2015 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2011 &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;tfoot&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; + p &amp;lt; 0.1, * p &amp;lt; 0.05, ** p &amp;lt; 0.01, *** p &amp;lt; 0.001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Fixed effects: Dyad and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Clustered standard errors by dyad and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Zero imputation on dyads with missing on TC connections.&lt;/td&gt;&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;/table&gt;
&gt; alldata1_dich &lt;- alldata1 %&gt;% mutate(weight = ifelse(weight &gt;= 
+     1, 1, weight))

&gt; alldata2_dich &lt;- alldata2 %&gt;% mutate(weight = ifelse(weight &gt;= 
+     1, 1, weight))

&gt; alldata3_dich &lt;- alldata3 %&gt;% mutate(weight = ifelse(weight &gt;= 
+     1, 1, weight))

&gt; mod_all0 &lt;- feols(logtrade ~ weight | dyad_id + cty_1 + 
+     cty_2 + year, cluster = "dyad_id+year", data = alldata1_dich)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 7,242 observations removed because of NA values (Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all1 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad | 
+     dyad_id + cty_1 + cty_2 + year, cluster = "dyad_id+year", 
+     data = alldata1_d .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 62,943 observations removed because of NA values (RHS: 62,943, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all2 &lt;- feols(logtrade ~ weight + patents_cty_1 + 
+     patents_cty_2 + fta_wto + wto_dyad | dyad_id + cty_1 + cty_2 + 
+     year, cluster = " ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 180,053 observations removed because of NA values (RHS: 180,053, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all3 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad + 
+     dem_dyad + pta + comcur | dyad_id + cty_1 + cty_2 + year, 
+     cluster = "dyad_i ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 70,035 observations removed because of NA values (RHS: 70,035, Fixed-effects: 4,653).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all4 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad + 
+     dem_dyad + pta + comcur + alliance + rivalry | dyad_id + 
+     cty_1 + cty_2 + ye .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 45,514 observations removed because of NA values (RHS: 45,514, Fixed-effects: 3,095).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; cm &lt;- c(weight = "Presence of TC connection", patents_cty_1 = "Patents (exporter) as share of GDP", 
+     patents_cty_2 = "Patents (importer) as sh ..." ... [TRUNCATED] 

&gt; models &lt;- list(mod_all0, mod_all1, mod_all2, mod_all3, 
+     mod_all4)

&gt; names(models) &lt;- c("Baseline", "Gravity", "Gravity+R&amp;D", 
+     "Gravity++", "Gravity+++")

&gt; rows &lt;- tibble::tribble(~start, ~mod_all0, ~mod_all1, 
+     ~mod_all2, ~mod_all3, ~mod_all4, "Controls", "No", "Gravity", 
+     "Gravity+R&amp;D", "Gr ..." ... [TRUNCATED] 

&gt; tabsummary &lt;- modelsummary(models, fmt = 3, coef_map = cm, 
+     stars = TRUE, gof_omit = "AIC|BIC|Within|Std.Errors|R2|FE", 
+     notes = c("Fixe ..." ... [TRUNCATED] 

&gt; tabsummary %&gt;% add_header_above(c(` ` = 1, `Dependent variable: Presence of TC membership (binary) (UN Comtrade)` = 5)) %&gt;% 
+     kable_styling(fon .... [TRUNCATED] 
&lt;table style="NAborder-bottom: 0; width: auto !important; margin-left: auto; margin-right: auto; font-size: 10px; width: auto !important; margin-left: auto; margin-right: auto;" class="table table"&gt;
 &lt;thead&gt;
&lt;tr&gt;
&lt;th style="empty-cells: hide;border-bottom:hidden;" colspan="1"&gt;&lt;/th&gt;
&lt;th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="5"&gt;&lt;div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; "&gt;Dependent variable: Presence of TC membership (binary) (UN Comtrade)&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
  &lt;tr&gt;
   &lt;th style="text-align:left;"&gt;   &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Baseline &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity++ &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+++ &lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Presence of TC connection &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.147*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.177*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.159*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.137** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.085+ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.031) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.038) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.029) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.033) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.041) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (exporter) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.013** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.003) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (importer) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.005** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.001) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Regional trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.037 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.096* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.069 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.124+ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.043) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.041) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.039) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.056) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; WTO dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.116* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.169** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.072 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.110 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.041) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.045) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.062) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.110) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Democratic dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.001 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.008 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.027) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.027) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Preferential trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.018 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.016 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.045) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.039) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Common currency &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.202* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.191* &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.072) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.078) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Alliance &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.018 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.076) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Strategic rivals &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.031 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.070) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Num.Obs. &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 402385 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 346684 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 229574 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 190173 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 125511 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; RMSE &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.38 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.38 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.26 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.25 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.14 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Controls &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; No &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity++ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Time series &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2015 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2011 &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;tfoot&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; + p &amp;lt; 0.1, * p &amp;lt; 0.05, ** p &amp;lt; 0.01, *** p &amp;lt; 0.001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Fixed effects: Dyad and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Clustered standard errors by dyad and year.&lt;/td&gt;&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;/table&gt;
&gt; cm &lt;- c(weight = "ln(TC connections)", patents_cty_1 = "Patents (exporter) as share of GDP", 
+     patents_cty_2 = "Patents (importer) as share of  ..." ... [TRUNCATED] 

&gt; mod_all0 &lt;- feols(logtrade ~ weight | cty_1 + cty_2 + 
+     year, cluster = "cty_1+cty_2+year", data = alldata1)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 7,242 observations removed because of NA values (Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all1 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad | 
+     cty_1 + cty_2 + year, cluster = "cty_1+cty_2+year", data = alldata1)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 62,943 observations removed because of NA values (RHS: 62,943, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all2 &lt;- feols(logtrade ~ weight + patents_cty_1 + 
+     patents_cty_2 + fta_wto + wto_dyad | cty_1 + cty_2 + year, 
+     cluster = "cty_1+cty_ ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 180,053 observations removed because of NA values (RHS: 180,053, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all3 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad + 
+     dem_dyad + pta + comcur | cty_1 + cty_2 + year, cluster = "cty_1+cty_2+year", 
+   .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 70,035 observations removed because of NA values (RHS: 70,035, Fixed-effects: 4,653).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all4 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad + 
+     dem_dyad + pta + comcur + alliance + rivalry | cty_1 + cty_2 + 
+     year, cluste .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 45,514 observations removed because of NA values (RHS: 45,514, Fixed-effects: 3,095).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; models &lt;- list(mod_all0, mod_all1, mod_all2, mod_all3, 
+     mod_all4)

&gt; names(models) &lt;- c("Baseline", "Gravity", "Gravity+R&amp;D", 
+     "Gravity++", "Gravity+++")

&gt; rows &lt;- tibble::tribble(~start, ~mod_all0, ~mod_all1, 
+     ~mod_all2, ~mod_all3, ~mod_all4, "Controls", "No", "Gravity", 
+     "Gravity+R&amp;D", "Gr ..." ... [TRUNCATED] 

&gt; tabsummary &lt;- modelsummary(models, fmt = 3, coef_map = cm, 
+     stars = TRUE, gof_omit = "AIC|BIC|Within|Std.Errors|R2|FE", 
+     notes = c("Fixe ..." ... [TRUNCATED] 

&gt; tabsummary %&gt;% add_header_above(c(` ` = 1, `Dependent variable: ln(Dyadic trade) (UN Comtrade)` = 5)) %&gt;% 
+     kable_styling(font_size = 8, full_w .... [TRUNCATED] 
&lt;table style="NAborder-bottom: 0; width: auto !important; margin-left: auto; margin-right: auto; font-size: 8px; width: auto !important; margin-left: auto; margin-right: auto;" class="table table"&gt;
 &lt;thead&gt;
&lt;tr&gt;
&lt;th style="empty-cells: hide;border-bottom:hidden;" colspan="1"&gt;&lt;/th&gt;
&lt;th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="5"&gt;&lt;div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; "&gt;Dependent variable: ln(Dyadic trade) (UN Comtrade)&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
  &lt;tr&gt;
   &lt;th style="text-align:left;"&gt;   &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Baseline &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity++ &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+++ &lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; ln(TC connections) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.490*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.383*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.248*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.149** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.026 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.053) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.051) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.049) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.041) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.041) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (exporter) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.015* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.005) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (importer) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.005* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.002) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Regional trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2.105*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.954*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2.362*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.564*** &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.149) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.151) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.157) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.140) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; WTO dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.371* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.164 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.408* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.752* &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.146) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.112) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.184) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.239) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Democratic dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.193* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.109 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.076) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.068) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Preferential trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.823** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.432+ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.227) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.225) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Common currency &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.125* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.419 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.394) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.406) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Alliance &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.877*** &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.154) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Strategic rivals &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.426* &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.499) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Num.Obs. &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 402385 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 346684 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 229574 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 190173 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 125511 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; RMSE &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2.57 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2.51 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2.34 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2.34 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2.21 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Controls &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; No &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity++ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Time series &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2015 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2011 &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;tfoot&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; + p &amp;lt; 0.1, * p &amp;lt; 0.05, ** p &amp;lt; 0.01, *** p &amp;lt; 0.001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Fixed effects: Country 1, country 2 and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Clustered standard errors by country 1, country 2 and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Zero imputation on dyads with missing on TC connections.&lt;/td&gt;&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;/table&gt;
&gt; mod_all0 &lt;- feols(logtrade ~ weight | cty_1_region + 
+     cty_2_region + year, cluster = "cty_1_region+cty_2_region+year", 
+     data = alldata1)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 10,581 observations removed because of NA values (Fixed-effects: 10,581).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all1 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad | 
+     cty_1_region + cty_2_region + year, cluster = "cty_1_region+cty_2_region+year", 
+ .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 64,735 observations removed because of NA values (RHS: 62,943, Fixed-effects: 10,581).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all2 &lt;- feols(logtrade ~ weight + patents_cty_1 + 
+     patents_cty_2 + fta_wto + wto_dyad | cty_1_region + cty_2_region + 
+     year, cluster .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 180,053 observations removed because of NA values (RHS: 180,053, Fixed-effects: 10,581).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Variance contained negative values in the diagonal and was 'fixed' (a la Cameron, Gelbach &amp; Miller 2011).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all3 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad + 
+     dem_dyad + pta + comcur | cty_1_region + cty_2_region + year, 
+     cluster = "ct ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 70,035 observations removed because of NA values (RHS: 70,035, Fixed-effects: 6,995).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all4 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad + 
+     dem_dyad + pta + comcur + alliance + rivalry | cty_1_region + 
+     cty_2_region  .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 45,514 observations removed because of NA values (RHS: 45,514, Fixed-effects: 4,749).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; models &lt;- list(mod_all0, mod_all1, mod_all2, mod_all3, 
+     mod_all4)

&gt; names(models) &lt;- c("Baseline", "Gravity", "Gravity+R&amp;D", 
+     "Gravity++", "Gravity+++")

&gt; rows &lt;- tibble::tribble(~start, ~mod_all0, ~mod_all1, 
+     ~mod_all2, ~mod_all3, ~mod_all4, "Controls", "No", "Gravity", 
+     "Gravity+R&amp;D", "Gr ..." ... [TRUNCATED] 

&gt; tabsummary &lt;- modelsummary(models, fmt = 3, coef_map = cm, 
+     stars = TRUE, gof_omit = "AIC|BIC|Within|Std.Errors|R2|FE", 
+     notes = c("Fixe ..." ... [TRUNCATED] 

&gt; tabsummary %&gt;% add_header_above(c(` ` = 1, `Dependent variable: ln(Dyadic trade) (UN Comtrade)` = 5)) %&gt;% 
+     kable_styling(font_size = 10, full_ .... [TRUNCATED] 
&lt;table style="NAborder-bottom: 0; width: auto !important; margin-left: auto; margin-right: auto; font-size: 10px; width: auto !important; margin-left: auto; margin-right: auto;" class="table table"&gt;
 &lt;thead&gt;
&lt;tr&gt;
&lt;th style="empty-cells: hide;border-bottom:hidden;" colspan="1"&gt;&lt;/th&gt;
&lt;th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="5"&gt;&lt;div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; "&gt;Dependent variable: ln(Dyadic trade) (UN Comtrade)&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
  &lt;tr&gt;
   &lt;th style="text-align:left;"&gt;   &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Baseline &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity++ &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+++ &lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; ln(TC connections) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.416*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.263*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.274*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.076*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.061*** &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.052) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.037) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.065) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.038) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.037) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (exporter) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.046 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.029) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (importer) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.007 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.004) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Regional trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.366** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.434** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.847*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.423** &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.327) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.276) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.281) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.282) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; WTO dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.975** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.431* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.374* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.413+ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.225) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.142) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.129) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.184) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Democratic dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.053 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.052 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.147) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.116) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Preferential trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.547+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.216 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.240) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.143) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Common currency &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.924 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.505 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.588) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.631) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Alliance &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.198* &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.393) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Strategic rivals &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.940* &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.662) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Num.Obs. &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 399046 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 344892 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 229574 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 190173 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 125511 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; RMSE &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 3.27 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 3.22 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 3.02 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 3.10 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 3.06 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Controls &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; No &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity++ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Time series &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2015 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2011 &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;tfoot&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; + p &amp;lt; 0.1, * p &amp;lt; 0.05, ** p &amp;lt; 0.01, *** p &amp;lt; 0.001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Fixed effects: Region for country 1, region for country 2 and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Clustered standard errors by region for country 1, region for country 2 and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Zero imputation on dyads with missing on TC connections.&lt;/td&gt;&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;/table&gt;
&gt; alldata1_rollmean &lt;- alldata1 %&gt;% mutate(period = cut(alldata1$year, 
+     seq(2000, 2025, by = 5), right = FALSE)) %&gt;% dplyr::group_by(dyad_id, 
+ .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>`summarise()` has grouped output by 'dyad_id'. You can override using the
`.groups` argument.</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; alldata2_rollmean &lt;- alldata2 %&gt;% mutate(period = cut(alldata2$year, 
+     seq(2000, 2025, by = 5), right = FALSE)) %&gt;% dplyr::group_by(dyad_id, 
+ .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>`summarise()` has grouped output by 'dyad_id'. You can override using the
`.groups` argument.</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; alldata3_rollmean &lt;- alldata3 %&gt;% mutate(period = cut(alldata3$year, 
+     seq(2000, 2025, by = 5), right = FALSE)) %&gt;% dplyr::group_by(dyad_id, 
+ .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>`summarise()` has grouped output by 'dyad_id'. You can override using the
`.groups` argument.</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all0 &lt;- feols(logtrade ~ weight | dyad_id + period, 
+     cluster = "dyad_id+period", data = alldata1_rollmean)

&gt; mod_all1 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad | 
+     dyad_id + period, cluster = "dyad_id+period", data = alldata1_rollmean)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 28,932 observations removed because of NA values (RHS: 28,932).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all2 &lt;- feols(logtrade ~ weight + patents_cty_1 + 
+     patents_cty_2 + fta_wto + wto_dyad | dyad_id + period, cluster = "dyad_id+period", 
+   .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 68,096 observations removed because of NA values (RHS: 68,096).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all3 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad + 
+     dem_dyad + pta + comcur | dyad_id + period, cluster = "dyad_id+period", 
+     dat .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 28,189 observations removed because of NA values (RHS: 28,189).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all4 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad + 
+     dem_dyad + pta + comcur + alliance + rivalry | dyad_id + 
+     period, cluster =  .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 20,412 observations removed because of NA values (RHS: 20,412).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; models &lt;- list(mod_all0, mod_all1, mod_all2, mod_all3, 
+     mod_all4)

&gt; names(models) &lt;- c("Baseline", "Gravity", "Gravity+R&amp;D", 
+     "Gravity++", "Gravity+++")

&gt; rows &lt;- tibble::tribble(~start, ~mod_all0, ~mod_all1, 
+     ~mod_all2, ~mod_all3, ~mod_all4, "Controls", "No", "Gravity", 
+     "Gravity+R&amp;D", "Gr ..." ... [TRUNCATED] 

&gt; tabsummary &lt;- modelsummary(models, fmt = 3, coef_map = cm, 
+     stars = TRUE, gof_omit = "AIC|BIC|Within|Std.Errors|R2|FE", 
+     notes = c("Fixe ..." ... [TRUNCATED] 

&gt; tabsummary %&gt;% add_header_above(c(` ` = 1, `Dependent variable: ln(Dyadic trade) (UN Comtrade)` = 5)) %&gt;% 
+     kable_styling(font_size = 10, full_ .... [TRUNCATED] 
&lt;table style="NAborder-bottom: 0; width: auto !important; margin-left: auto; margin-right: auto; font-size: 10px; width: auto !important; margin-left: auto; margin-right: auto;" class="table table"&gt;
 &lt;thead&gt;
&lt;tr&gt;
&lt;th style="empty-cells: hide;border-bottom:hidden;" colspan="1"&gt;&lt;/th&gt;
&lt;th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="5"&gt;&lt;div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; "&gt;Dependent variable: ln(Dyadic trade) (UN Comtrade)&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
  &lt;tr&gt;
   &lt;th style="text-align:left;"&gt;   &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Baseline &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity++ &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+++ &lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; ln(TC connections) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.121** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.145** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.083** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.073* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.069 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.022) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.028) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.017) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.020) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.039) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (exporter) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.014 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.007) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (importer) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.009+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.003) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Regional trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.084 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.161+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.024 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.162 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.080) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.063) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.041) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.080) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; WTO dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.077 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.132 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.097 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.039 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.089) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.097) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.098) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.112) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Democratic dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.064 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.004 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.052) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.047) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Preferential trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.050 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.036 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.057) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.077) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Common currency &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.225* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.302* &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.070) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.063) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Alliance &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.026 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.094) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Strategic rivals &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.028 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.197) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Num.Obs. &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 127945 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 99013 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 59849 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 70600 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 51975 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; RMSE &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.18 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.17 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.05 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.06 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.91 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Controls &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; No &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity++ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Time series &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2015 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2011 &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;tfoot&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; + p &amp;lt; 0.1, * p &amp;lt; 0.05, ** p &amp;lt; 0.01, *** p &amp;lt; 0.001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Fixed effects: Region for dyad and 5-year period.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Clustered standard errors by dyad and 5-year period.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Zero imputation on dyads with missing on TC connections.&lt;/td&gt;&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;/table&gt;
&gt; cm &lt;- c(weight_no_impute = "ln(TC connections)", patents_cty_1 = "Patents (exporter) as share of GDP", 
+     patents_cty_2 = "Patents (importer) as ..." ... [TRUNCATED] 

&gt; mod_all0 &lt;- feols(logtrade ~ weight_no_impute | dyad_id + 
+     cty_1 + cty_2 + year, cluster = "dyad_id+year", data = alldata1)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 233,523 observations removed because of NA values (RHS: 233,523, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all1 &lt;- feols(logtrade ~ weight_no_impute + fta_wto + 
+     wto_dyad | dyad_id + cty_1 + cty_2 + year, cluster = "dyad_id+year", 
+     data =  .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 261,109 observations removed because of NA values (RHS: 261,109, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all2 &lt;- feols(logtrade ~ weight_no_impute + patents_cty_1 + 
+     patents_cty_2 + fta_wto + wto_dyad | dyad_id + cty_1 + cty_2 + 
+     year, c .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 279,849 observations removed because of NA values (RHS: 279,849, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all3 &lt;- feols(logtrade ~ weight_no_impute + fta_wto + 
+     wto_dyad + dem_dyad + pta + comcur | dyad_id + cty_1 + cty_2 + 
+     year, cluster .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 178,718 observations removed because of NA values (RHS: 178,718, Fixed-effects: 4,653).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all4 &lt;- feols(logtrade ~ weight_no_impute + fta_wto + 
+     wto_dyad + dem_dyad + pta + comcur + alliance + rivalry | 
+     dyad_id + cty_1 +  .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 124,074 observations removed because of NA values (RHS: 124,074, Fixed-effects: 3,095).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; models &lt;- list(mod_all0, mod_all1, mod_all2, mod_all3, 
+     mod_all4)

&gt; names(models) &lt;- c("Baseline", "Gravity", "Gravity+R&amp;D", 
+     "Gravity++", "Gravity+++")

&gt; rows &lt;- tibble::tribble(~start, ~mod_all0, ~mod_all1, 
+     ~mod_all2, ~mod_all3, ~mod_all4, "Controls", "No", "Gravity", 
+     "Gravity+R&amp;D", "Gr ..." ... [TRUNCATED] 

&gt; tabsummary &lt;- modelsummary(models, fmt = 3, coef_map = cm, 
+     stars = TRUE, gof_omit = "AIC|BIC|Within|Std.Errors|R2|FE", 
+     notes = c("Fixe ..." ... [TRUNCATED] 

&gt; tabsummary %&gt;% add_header_above(c(` ` = 1, `Dependent variable: ln(Dyadic trade) (UN Comtrade)` = 5)) %&gt;% 
+     kable_styling(font_size = 10, full_ .... [TRUNCATED] 
&lt;table style="NAborder-bottom: 0; width: auto !important; margin-left: auto; margin-right: auto; font-size: 10px; width: auto !important; margin-left: auto; margin-right: auto;" class="table table"&gt;
 &lt;thead&gt;
&lt;tr&gt;
&lt;th style="empty-cells: hide;border-bottom:hidden;" colspan="1"&gt;&lt;/th&gt;
&lt;th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="5"&gt;&lt;div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; "&gt;Dependent variable: ln(Dyadic trade) (UN Comtrade)&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
  &lt;tr&gt;
   &lt;th style="text-align:left;"&gt;   &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Baseline &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity++ &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+++ &lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; ln(TC connections) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.059*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.063*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.029+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.082** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.060+ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.013) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.014) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.015) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.020) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.028) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (exporter) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.014** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.004) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (importer) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.012** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.004) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Regional trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.024 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.026 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.060 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.176+ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.034) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.031) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.049) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.085) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; WTO dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.135+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.167* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.095 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.097 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.075) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.075) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.091) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.115) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Democratic dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.026 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.016 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.032) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.035) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Preferential trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.010 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.010 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.049) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.045) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Common currency &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.060 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.060 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.061) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.061) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Alliance &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.008 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.076) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Strategic rivals &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.016 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.083) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Num.Obs. &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 176104 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 148518 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 129778 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 81490 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 46951 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; RMSE &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.05 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.06 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.99 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.94 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.84 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Controls &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; No &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity++ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Time series &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2015 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2011 &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;tfoot&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; + p &amp;lt; 0.1, * p &amp;lt; 0.05, ** p &amp;lt; 0.01, *** p &amp;lt; 0.001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Fixed effects: Dyad and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Clustered standard errors by dyad and year.&lt;/td&gt;&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;/table&gt;
&gt; cm &lt;- c(weight = "ln(TC connections)", wipo_patents_cty_1 = "Patents (exporter) as share of GDP", 
+     wipo_patents_cty_2 = "Patents (importer) as ..." ... [TRUNCATED] 

&gt; mod_all0 &lt;- feols(logtrade ~ weight | dyad_id + cty_1 + 
+     cty_2 + year, cluster = "dyad_id+year", data = alldata1)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 7,242 observations removed because of NA values (Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all1 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad | 
+     dyad_id + cty_1 + cty_2 + year, cluster = "dyad_id+year", 
+     data = alldata1)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 62,943 observations removed because of NA values (RHS: 62,943, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all2 &lt;- feols(logtrade ~ weight + wipo_patents_cty_1 + 
+     wipo_patents_cty_2 + fta_wto + wto_dyad | dyad_id + cty_1 + 
+     cty_2 + year, c .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 268,201 observations removed because of NA values (RHS: 268,201, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all3 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad + 
+     dem_dyad + pta + comcur | dyad_id + cty_1 + cty_2 + year, 
+     cluster = "dyad_i ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 70,035 observations removed because of NA values (RHS: 70,035, Fixed-effects: 4,653).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all4 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad + 
+     dem_dyad + pta + comcur + alliance + rivalry | dyad_id + 
+     cty_1 + cty_2 + ye .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 45,514 observations removed because of NA values (RHS: 45,514, Fixed-effects: 3,095).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; models &lt;- list(mod_all0, mod_all1, mod_all2, mod_all3, 
+     mod_all4)

&gt; names(models) &lt;- c("Baseline", "Gravity", "Gravity+R&amp;D", 
+     "Gravity+", "Gravity++")

&gt; rows &lt;- tibble::tribble(~start, ~mod_all0, ~mod_all1, 
+     ~mod_all2, ~mod_all3, ~mod_all4, "Controls", "No", "Gravity", 
+     "Gravity+R&amp;D", "Gr ..." ... [TRUNCATED] 

&gt; tabsummary &lt;- modelsummary(models, fmt = 3, coef_map = cm, 
+     stars = TRUE, gof_omit = "AIC|BIC|Within|Std.Errors|R2|FE", 
+     notes = c("Fixe ..." ... [TRUNCATED] 

&gt; tabsummary %&gt;% add_header_above(c(` ` = 1, `Dependent variable: ln(Dyadic trade) (UN Comtrade)` = 5)) %&gt;% 
+     kable_styling(font_size = 8, full_w .... [TRUNCATED] 
&lt;table style="NAborder-bottom: 0; width: auto !important; margin-left: auto; margin-right: auto; font-size: 8px; width: auto !important; margin-left: auto; margin-right: auto;" class="table table"&gt;
 &lt;thead&gt;
&lt;tr&gt;
&lt;th style="empty-cells: hide;border-bottom:hidden;" colspan="1"&gt;&lt;/th&gt;
&lt;th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="5"&gt;&lt;div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; "&gt;Dependent variable: ln(Dyadic trade) (UN Comtrade)&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
  &lt;tr&gt;
   &lt;th style="text-align:left;"&gt;   &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Baseline &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+ &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity++ &lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; ln(TC connections) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.073*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.084*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.056*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.036* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.031 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.014) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.017) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.011) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.016) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.019) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (exporter) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.000 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.001) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (importer) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.001 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.001) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Regional trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.040 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.004 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.069 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.125+ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.042) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.028) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.041) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.056) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; WTO dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.122** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.082 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.073 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.112 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.040) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.060) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.061) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.110) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Democratic dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.002 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.008 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.026) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.027) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Preferential trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.020 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.016 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.045) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.039) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Common currency &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.172* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.178* &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.072) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.073) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Alliance &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.022 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.076) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Strategic rivals &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.037 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.070) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Num.Obs. &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 402385 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 346684 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 141426 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 190173 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 125511 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; RMSE &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.38 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.38 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.02 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.25 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.14 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Controls &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; No &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+ &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity++ &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Time series &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2015 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2011 &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;tfoot&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; + p &amp;lt; 0.1, * p &amp;lt; 0.05, ** p &amp;lt; 0.01, *** p &amp;lt; 0.001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Fixed effects by dyad, country and year, clustered standard errors by dyad and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Zero imputation on dyads with missing on TC connections.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Gravity controls: GDP, population, distance between capitals, common language, regional trade agreement, WTO dyad.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Gravity+R&amp;amp;D controls: Adds to Gravity patents per country.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Gravity+ controls: Adds to Gravity+ democratic dyad, preferential trade agreement, common currency.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Gravity++ controls: Adds to Gravity++ strategic rivalry, alliance.&lt;/td&gt;&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;/table&gt;
&gt; cm &lt;- c(weight = "ln(TC connections)", patents_cty_1 = "Patents (exporter) as share of GDP", 
+     patents_cty_2 = "Patents (importer) as share of  ..." ... [TRUNCATED] 

&gt; mod_all0 &lt;- feols(logtrade ~ weight | dyad_id + cty_1 + 
+     cty_2 + year, cluster = "dyad_id+year", data = alldata1)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 7,242 observations removed because of NA values (Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all1 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad | 
+     dyad_id + cty_1 + cty_2 + year, cluster = "dyad_id+year", 
+     data = alldata1)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 62,943 observations removed because of NA values (RHS: 62,943, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all2 &lt;- feols(logtrade ~ weight + patents_cty_1 + 
+     patents_cty_2 + fta_wto + wto_dyad | dyad_id + cty_1 + cty_2 + 
+     year, cluster = " ..." ... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 180,053 observations removed because of NA values (RHS: 180,053, Fixed-effects: 7,242).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all3 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad | 
+     dyad_id + cty_1 + cty_2 + year, cluster = "dyad_id+year", 
+     data = alldata2)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 31,959 observations removed because of NA values (RHS: 31,959, Fixed-effects: 4,653).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; mod_all4 &lt;- feols(logtrade ~ weight + fta_wto + wto_dyad | 
+     dyad_id + cty_1 + cty_2 + year, cluster = "dyad_id+year", 
+     data = alldata3)</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>NOTE: 20,701 observations removed because of NA values (RHS: 20,701, Fixed-effects: 3,095).</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; models &lt;- list(mod_all0, mod_all1, mod_all2, mod_all3, 
+     mod_all4)

&gt; names(models) &lt;- c("Baseline", "Gravity", "Gravity+R&amp;D", 
+     "Gravity", "Gravity")

&gt; rows &lt;- tibble::tribble(~start, ~mod_all0, ~mod_all1, 
+     ~mod_all2, ~mod_all3, ~mod_all4, "Controls", "No", "Gravity", 
+     "Gravity+R&amp;D", "Gr ..." ... [TRUNCATED] 

&gt; tabsummary &lt;- modelsummary(models, fmt = 3, coef_map = cm, 
+     stars = TRUE, gof_omit = "AIC|BIC|Within|Std.Errors|R2|FE", 
+     notes = c("Fixe ..." ... [TRUNCATED] 

&gt; tabsummary %&gt;% add_header_above(c(` ` = 1, `Dependent variable: ln(Dyadic trade) (UN Comtrade)` = 5)) %&gt;% 
+     kable_styling(font_size = 8, full_w .... [TRUNCATED] 
&lt;table style="NAborder-bottom: 0; width: auto !important; margin-left: auto; margin-right: auto; font-size: 8px; width: auto !important; margin-left: auto; margin-right: auto;" class="table table"&gt;
 &lt;thead&gt;
&lt;tr&gt;
&lt;th style="empty-cells: hide;border-bottom:hidden;" colspan="1"&gt;&lt;/th&gt;
&lt;th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="5"&gt;&lt;div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; "&gt;Dependent variable: ln(Dyadic trade) (UN Comtrade)&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
  &lt;tr&gt;
   &lt;th style="text-align:left;"&gt;   &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Baseline &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity  &lt;/th&gt;
   &lt;th style="text-align:center;"&gt; Gravity   &lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; ln(TC connections) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.073*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.084*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.057*** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.071** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 0.056* &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.014) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.017) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.013) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.017) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.021) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (exporter) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.013** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.003) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Patents (importer) as share of GDP &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.005** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.001) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Regional trade agreement &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.040 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.093* &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.174** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.228** &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.042) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.040) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.055) &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; (0.055) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; WTO dyad &lt;/td&gt;
   &lt;td style="text-align:center;"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.122** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.169** &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.071 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; −0.085 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt;  &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.040) &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.044) &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.051) &lt;/td&gt;
   &lt;td style="text-align:center;box-shadow: 0px 1.5px"&gt; (0.093) &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Num.Obs. &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 402385 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 346684 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 229574 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 228249 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 150324 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; RMSE &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.38 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.38 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.26 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.29 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 1.18 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Controls &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; No &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity+R&amp;amp;D &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; Gravity &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td style="text-align:left;"&gt; Time series &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2022 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2021 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2015 &lt;/td&gt;
   &lt;td style="text-align:center;"&gt; 2004-2011 &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;tfoot&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; + p &amp;lt; 0.1, * p &amp;lt; 0.05, ** p &amp;lt; 0.01, *** p &amp;lt; 0.001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Fixed effects by dyad, country and year, clustered standard errors by dyad and year.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="padding: 0; " colspan="100%"&gt;
&lt;sup&gt;&lt;/sup&gt; Zero imputation on dyads with missing on TC connections.&lt;/td&gt;&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;/table&gt;
&gt; p_data1 &lt;- pdata.frame(alldata1, index = c("dyad_id", 
+     "year"))

&gt; p_data2 &lt;- pdata.frame(alldata2 %&gt;% select(logtrade, 
+     weight, patents_cty_1, patents_cty_2, gdpcap_d, gdpcap_o, 
+     pop_d, pop_o, distcap,  .... [TRUNCATED] 

&gt; p_data3 &lt;- pdata.frame(alldata3 %&gt;% select(logtrade, 
+     weight, patents_cty_1, patents_cty_2, gdpcap_d, gdpcap_o, 
+     pop_d, pop_o, distcap,  .... [TRUNCATED] 

&gt; gmm_all0 &lt;- pgmm(logtrade ~ lag(logtrade, 1:2) + lag(weight, 
+     0:1) | lag(logtrade, 2:10), data = p_data1, effect = "twoways", 
+     model = " ..." ... [TRUNCATED] 

&gt; gmm_all1 &lt;- pgmm(logtrade ~ lag(logtrade, 1:2) + lag(weight, 
+     0:1) + fta_wto + wto_dyad | lag(logtrade, 2:10), data = p_data1, 
+     effect = .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in pgmm(logtrade ~ lag(logtrade, 1:2) + lag(weight, 0:1) + fta_wto + :
the first-step matrix is singular, a general inverse is used</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in pgmm(logtrade ~ lag(logtrade, 1:2) + lag(weight, 0:1) + fta_wto + :
the second-step matrix is singular, a general inverse is used</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; gmm_all2 &lt;- pgmm(logtrade ~ lag(logtrade, 1:2) + lag(weight, 
+     0:1) + patents_cty_1 + patents_cty_2 + fta_wto + wto_dyad | 
+     lag(logtrade, .... [TRUNCATED] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in pgmm(logtrade ~ lag(logtrade, 1:2) + lag(weight, 0:1) + patents_cty_1
+ : the first-step matrix is singular, a general inverse is used</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in pgmm(logtrade ~ lag(logtrade, 1:2) + lag(weight, 0:1) + patents_cty_1
+ : the second-step matrix is singular, a general inverse is used</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
&gt; gmm_all3 &lt;- pgmm(logtrade ~ lag(logtrade, 1:2) + lag(weight, 
+     0:1) + fta_wto + wto_dyad + dem_dyad + pta + comcur | lag(logtrade, 
+     3:10) .... [TRUNCATED] 

&gt; gmm_all4 &lt;- pgmm(logtrade ~ lag(logtrade, 1:2) + lag(weight, 
+     0:1) + fta_wto + wto_dyad + dem_dyad + pta + comcur + alliance + 
+     rivalry  .... [TRUNCATED] 

&gt; mtest(gmm_all0)

    Arellano-Bond autocorrelation test of degree 1

data:  logtrade ~ lag(logtrade, 1:2) + lag(weight, 0:1) | lag(logtrade,  ...
normal = -49.857, p-value &lt; 0.00000000000000022
alternative hypothesis: autocorrelation present


&gt; cm &lt;- c(`lag(logtrade, 1 × 2)1` = "Lag ln(dyadic trade), 1", 
+     `lag(logtrade, 1 × 2)2` = "Lag ln(dyadic trade), 2", `lag(weight, 0 × 2)0 ` = "l ..." ... [TRUNCATED] 

&gt; models &lt;- list(gmm_all0, gmm_all1, gmm_all2, gmm_all3, 
+     gmm_all4)

&gt; names(models) &lt;- c("Baseline", "Gravity", "Gravity+R&amp;D", 
+     "Gravity++", "Gravity+++")

&gt; rows &lt;- tibble::tribble(~start, ~gmm_all0, ~gmm_all1, 
+     ~gmm_all2, ~gmm_all3, ~gmm_all4, "Controls", "No", "Gravity", 
+     "Gravity+R&amp;D", "Gr ..." ... [TRUNCATED] 

&gt; tabsummary &lt;- modelsummary(models, fmt = 3, stars = TRUE, 
+     gof_map = "none", notes = c("Fixed effects: Dyad and year.", 
+         "Clustered  ..." ... [TRUNCATED] 

&gt; gmm_summary &lt;- tabsummary %&gt;% add_header_above(c(` ` = 1, 
+     `Dependent variable: ln(Dyadic trade) (UN Comtrade)` = 5)) %&gt;% 
+     kable_styling .... [TRUNCATED] </code></pre>
</div>
</div>
</section>

</main>
<!-- /main column -->
<script id="quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
  const toggleBodyColorMode = (bsSheetEl) => {
    const mode = bsSheetEl.getAttribute("data-mode");
    const bodyEl = window.document.querySelector("body");
    if (mode === "dark") {
      bodyEl.classList.add("quarto-dark");
      bodyEl.classList.remove("quarto-light");
    } else {
      bodyEl.classList.add("quarto-light");
      bodyEl.classList.remove("quarto-dark");
    }
  }
  const toggleBodyColorPrimary = () => {
    const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
    if (bsSheetEl) {
      toggleBodyColorMode(bsSheetEl);
    }
  }
  toggleBodyColorPrimary();  
  const icon = "";
  const anchorJS = new window.AnchorJS();
  anchorJS.options = {
    placement: 'right',
    icon: icon
  };
  anchorJS.add('.anchored');
  const isCodeAnnotation = (el) => {
    for (const clz of el.classList) {
      if (clz.startsWith('code-annotation-')) {                     
        return true;
      }
    }
    return false;
  }
  const clipboard = new window.ClipboardJS('.code-copy-button', {
    text: function(trigger) {
      const codeEl = trigger.previousElementSibling.cloneNode(true);
      for (const childEl of codeEl.children) {
        if (isCodeAnnotation(childEl)) {
          childEl.remove();
        }
      }
      return codeEl.innerText;
    }
  });
  clipboard.on('success', function(e) {
    // button target
    const button = e.trigger;
    // don't keep focus
    button.blur();
    // flash "checked"
    button.classList.add('code-copy-button-checked');
    var currentTitle = button.getAttribute("title");
    button.setAttribute("title", "Copied!");
    let tooltip;
    if (window.bootstrap) {
      button.setAttribute("data-bs-toggle", "tooltip");
      button.setAttribute("data-bs-placement", "left");
      button.setAttribute("data-bs-title", "Copied!");
      tooltip = new bootstrap.Tooltip(button, 
        { trigger: "manual", 
          customClass: "code-copy-button-tooltip",
          offset: [0, -8]});
      tooltip.show();    
    }
    setTimeout(function() {
      if (tooltip) {
        tooltip.hide();
        button.removeAttribute("data-bs-title");
        button.removeAttribute("data-bs-toggle");
        button.removeAttribute("data-bs-placement");
      }
      button.setAttribute("title", currentTitle);
      button.classList.remove('code-copy-button-checked');
    }, 1000);
    // clear code selection
    e.clearSelection();
  });
  function tippyHover(el, contentFn) {
    const config = {
      allowHTML: true,
      content: contentFn,
      maxWidth: 500,
      delay: 100,
      arrow: false,
      appendTo: function(el) {
          return el.parentElement;
      },
      interactive: true,
      interactiveBorder: 10,
      theme: 'quarto',
      placement: 'bottom-start'
    };
    window.tippy(el, config); 
  }
  const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
  for (var i=0; i<noterefs.length; i++) {
    const ref = noterefs[i];
    tippyHover(ref, function() {
      // use id or data attribute instead here
      let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
      try { href = new URL(href).hash; } catch {}
      const id = href.replace(/^#\/?/, "");
      const note = window.document.getElementById(id);
      return note.innerHTML;
    });
  }
      let selectedAnnoteEl;
      const selectorForAnnotation = ( cell, annotation) => {
        let cellAttr = 'data-code-cell="' + cell + '"';
        let lineAttr = 'data-code-annotation="' +  annotation + '"';
        const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
        return selector;
      }
      const selectCodeLines = (annoteEl) => {
        const doc = window.document;
        const targetCell = annoteEl.getAttribute("data-target-cell");
        const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
        const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
        const lines = annoteSpan.getAttribute("data-code-lines").split(",");
        const lineIds = lines.map((line) => {
          return targetCell + "-" + line;
        })
        let top = null;
        let height = null;
        let parent = null;
        if (lineIds.length > 0) {
            //compute the position of the single el (top and bottom and make a div)
            const el = window.document.getElementById(lineIds[0]);
            top = el.offsetTop;
            height = el.offsetHeight;
            parent = el.parentElement.parentElement;
          if (lineIds.length > 1) {
            const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
            const bottom = lastEl.offsetTop + lastEl.offsetHeight;
            height = bottom - top;
          }
          if (top !== null && height !== null && parent !== null) {
            // cook up a div (if necessary) and position it 
            let div = window.document.getElementById("code-annotation-line-highlight");
            if (div === null) {
              div = window.document.createElement("div");
              div.setAttribute("id", "code-annotation-line-highlight");
              div.style.position = 'absolute';
              parent.appendChild(div);
            }
            div.style.top = top - 2 + "px";
            div.style.height = height + 4 + "px";
            let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
            if (gutterDiv === null) {
              gutterDiv = window.document.createElement("div");
              gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
              gutterDiv.style.position = 'absolute';
              const codeCell = window.document.getElementById(targetCell);
              const gutter = codeCell.querySelector('.code-annotation-gutter');
              gutter.appendChild(gutterDiv);
            }
            gutterDiv.style.top = top - 2 + "px";
            gutterDiv.style.height = height + 4 + "px";
          }
          selectedAnnoteEl = annoteEl;
        }
      };
      const unselectCodeLines = () => {
        const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
        elementsIds.forEach((elId) => {
          const div = window.document.getElementById(elId);
          if (div) {
            div.remove();
          }
        });
        selectedAnnoteEl = undefined;
      };
      // Attach click handler to the DT
      const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
      for (const annoteDlNode of annoteDls) {
        annoteDlNode.addEventListener('click', (event) => {
          const clickedEl = event.target;
          if (clickedEl !== selectedAnnoteEl) {
            unselectCodeLines();
            const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
            if (activeEl) {
              activeEl.classList.remove('code-annotation-active');
            }
            selectCodeLines(clickedEl);
            clickedEl.classList.add('code-annotation-active');
          } else {
            // Unselect the line
            unselectCodeLines();
            clickedEl.classList.remove('code-annotation-active');
          }
        });
      }
  const findCites = (el) => {
    const parentEl = el.parentElement;
    if (parentEl) {
      const cites = parentEl.dataset.cites;
      if (cites) {
        return {
          el,
          cites: cites.split(' ')
        };
      } else {
        return findCites(el.parentElement)
      }
    } else {
      return undefined;
    }
  };
  var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
  for (var i=0; i<bibliorefs.length; i++) {
    const ref = bibliorefs[i];
    const citeInfo = findCites(ref);
    if (citeInfo) {
      tippyHover(citeInfo.el, function() {
        var popup = window.document.createElement('div');
        citeInfo.cites.forEach(function(cite) {
          var citeDiv = window.document.createElement('div');
          citeDiv.classList.add('hanging-indent');
          citeDiv.classList.add('csl-entry');
          var biblioDiv = window.document.getElementById('ref-' + cite);
          if (biblioDiv) {
            citeDiv.innerHTML = biblioDiv.innerHTML;
          }
          popup.appendChild(citeDiv);
        });
        return popup.innerHTML;
      });
    }
  }
});
</script>
</div> <!-- /content -->



</body></html>